新版本 Gym 不支持 atari 下的环境,为方便学习运行一些代码,可进行版本回退,安装 gym版本为 0.19.0,atari_py 版本为 0.2.6 。安装操作均在 pycharm 的 terminal 终端命令行上执行。不存在环境时可能出现如下类似报错:
windows gym.error.NameNotFound: Environment Pong doesn't exist.
首先卸载已经安装过的新版本 gym
pip uninstall gym
下载旧版本的 gym 和 atari_py
pip --default-timeout=100 install gym==0.19.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install --no-index -f https://github.com/Kojoley/atari-py/releases atari_py==0.2.6
pip install pyglet==1.5.27
若出现类似报错:
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
error in gym setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output.
note: This is an issue with the package mentioned above, not pip. hint: See above for details.
参考:【debug日常】解决python setup.py egg_info did not run successfully. - 知乎 (zhihu.com)
利用以下命令解决:
pip install --upgrade pip setuptools==57.5.0
若安装完成后,运行出现以下类似报错:
FileNotFoundError: Could not find module 'D:\anaconda3\envs\pytorch\lib\site-packages\atari_py\ale_interface\ale_c.dll' (or one of its dependencies). Try using the full path with constructor syntax.
参考这篇文章中百度网盘中的链接,直接下载文件 ale_c.dll 复制进相应文件夹即可解决。
强化学习Gym Atari报错缺少ale_c.dll_could not find module 'ale_c.dll-CSDN博客
可成功运行 atari 下的环境 ‘Pong-v0’