我正在尝试运行 OpenAI Gym 环境:
env = gym.make("ALE/Breakout-v5", render_mode="rgb_array")
但是我得到以下错误
Traceback (most recent call last):
File "/Users/----/Documents/Spring 2023/----/----/yum.py", line 10, in <module>
env = gym.make("ALE/Breakout-v5", render_mode="rgb_array")
File "/Users/----/anaconda3/envs/----/lib/python3.10/site-packages/gymnasium/envs/registration.py", line 592, in make
_check_version_exists(ns, name, version)
File "/Users/----/anaconda3/envs/----/lib/python3.10/site-packages/gymnasium/envs/registration.py", line 218, in _check_version_exists
_check_name_exists(ns, name)
File "/Users/----/anaconda3/envs/----/lib/python3.10/site-packages/gymnasium/envs/registration.py", line 185, in _check_name_exists
_check_namespace_exists(ns)
File "/Users/----/anaconda3/envs/----/lib/python3.10/site-packages/gymnasium/envs/registration.py", line 180, in _check_namespace_exists
raise error.NamespaceNotFound(f"Namespace {ns} not found. {suggestion_msg}")
gymnasium.error.NamespaceNotFound: Namespace ALE not found. Have you installed the proper package for ALE?
我查看了人们在网上讨论的所有类似错误,但我找不到任何适合我的修复方法。
如下安装
gym
在我的环境中工作。 (蟒蛇 3.7)
pip install "gym[atari, accept-rom-license]"
如果您正在使用
gymnasium
:
pip install "gymnasium[atari, accept-rom-license]"
import gym # or "import gymnasium as gym"
if __name__ == '__main__':
env = gym.make("ALE/Breakout-v5")
A.L.E: Arcade Learning Environment (version 0.8.1+53f58b7)
[Powered by Stella]
安装前记得新建一个空环境