我正在这里学习本教程,以学习深度强化学习(对于这个话题我是很新的)。
当我尝试在Macbook上运行以下脚本时,它会向我返回导入错误(ImportError: sys.meta_path is None, Python is likely shutting down
)。我试图从Mac终端以及在Pycharm中运行它,结果相同。我还尝试了其他深度学习脚本,但错误是相同的(似乎与该脚本无关)。
您能帮我理解我哪里错了吗?
脚本:
# Import the gym module
import gym
# Create a breakout environment
env = gym.make('BreakoutDeterministic-v4')
# Reset it, returns the starting frame
frame = env.reset()
# Render
env.render()
is_done = False
while not is_done:
# Perform a random action, returns the new frame, reward and whether the game is over
frame, reward, is_done, _ = env.step(env.action_space.sample())
# Render
env.render()
错误如下:
/usr/local/bin/python3.6 /Users/marcogdepinto/PycharmProjects/PlayPong/pong.py
2018-05-12 18:58:11.915 Python[567:12594] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
Exception ignored in: <bound method SimpleImageViewer.__del__ of <gym.envs.classic_control.rendering.SimpleImageViewer object at 0x10b65bc88>>
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/gym/envs/classic_control/rendering.py", line 347, in __del__
File "/usr/local/lib/python3.6/site-packages/gym/envs/classic_control/rendering.py", line 343, in close
File "/usr/local/lib/python3.6/site-packages/pyglet/window/cocoa/__init__.py", line 281, in close
File "/usr/local/lib/python3.6/site-packages/pyglet/window/__init__.py", line 770, in close
ImportError: sys.meta_path is None, Python is likely shutting down
Process finished with exit code 0
“尝试
env.close()
在程序末尾添加,在我的情况下,效果很好”
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句