python - When I try to run the 'MountainCar-v0' gym from Open AI, all I get is a black screen
问题描述
I am running this on Mac OSX Mojave with Python 3.7
This is the code I am running, it shold run fine because I am following a tutorial by Sentdex. i have also tried adding a time.sleep(0.1) in the loop but that doesn't work either. I'm at a loss here and I just want to be able to run this agent and do some work on it.
Please help!!
import gym
import time
env = gym.make("MountainCar-v0")
env.reset()
done = False
while not done:
action = 2
new_state, reward, done, _ = env.step(action)
env.render()
time.sleep(0.1)
env.close()
解决方案
推荐阅读
- java - 为什么继承在这里不能正常工作?扩展 Java 类中的方法没有给我想要得到的结果
- javascript - 在 React 中更改背景图片的 URL
- javascript - 使用 for 循环时,如何在开始另一次提取之前等待一次提取完成?
- c++ - 我想在激活缓冲区后使用 cin 或 cout 。我应该怎么办
- python - 如何在 postgresql 数据库中导入 geojson 文件?
- javascript - 当为父母和孩子使用单独的点击事件时,它会影响下一个元素
- python - 嵌套文件读取不会遍历所有主循环
- javascript - 在使用 Jest 进行测试之前等待 React 组件状态更新
- python-3.x - 使用 Python 包连接到 Google Cloud 上的 Windows 虚拟机
- c# - SQL Server 和 Visual Studio:如何应对不同的 Microsoft.SqlServer.Types 版本