安装后没有名为 'atari_py' 的模块

No module named 'atari_py' after installation

我目前正在尝试使用 gym/openai 的 Atari 模块。我已经成功地安装了依赖项。

Patricks-MacBook-Pro:~ patrickmaynard$ python3.6 -m pip install gym[atari]
Requirement already satisfied: gym[atari] in /usr/local/lib/python3.6/site-packages (0.10.5)
Requirement already satisfied: six in /usr/local/lib/python3.6/site-packages (from gym[atari]) (1.11.0)
Requirement already satisfied: pyglet>=1.2.0 in /usr/local/lib/python3.6/site-packages (from gym[atari]) (1.3.2)
Requirement already satisfied: requests>=2.0 in /usr/local/lib/python3.6/site-packages (from gym[atari]) (2.18.4)
Requirement already satisfied: numpy>=1.10.4 in /usr/local/lib/python3.6/site-packages (from gym[atari]) (1.14.3)
Requirement already satisfied: Pillow; extra == "atari" in /usr/local/lib/python3.6/site-packages (from gym[atari]) (5.1.0)
Requirement already satisfied: PyOpenGL; extra == "atari" in /usr/local/lib/python3.6/site-packages (from gym[atari]) (3.1.0)
Requirement already satisfied: atari-py>=0.1.1; extra == "atari" in /usr/local/lib/python3.6/site-packages (from gym[atari]) (0.1.1)
Requirement already satisfied: future in /usr/local/lib/python3.6/site-packages (from pyglet>=1.2.0->gym[atari]) (0.16.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests>=2.0->gym[atari]) (2018.4.16)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests>=2.0->gym[atari]) (1.22)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests>=2.0->gym[atari]) (3.0.4)
Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests>=2.0->gym[atari]) (2.6)

但是,当我尝试 运行 文件时,编译器找不到模块,我收到以下错误:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gym/envs/atari/atari_env.py", line 9, in <module>
    import atari_py
ModuleNotFoundError: No module named 'atari_py'

在处理上述异常的过程中,又发生了一个异常:

Traceback (most recent call last):
  File "/Users/patrickmaynard/TicTacToe/recipe-578816-1.py", line 170, in <module>
    env = gym.make('Pong-v0')
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gym/envs/registration.py", line 167, in make
    return registry.make(id)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gym/envs/registration.py", line 119, in make
    env = spec.make()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gym/envs/registration.py", line 85, in make
    cls = load(self._entry_point)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gym/envs/registration.py", line 14, in load
    result = entry_point.load(False)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gym/envs/atari/__init__.py", line 1, in <module>
    from gym.envs.atari.atari_env import AtariEnv
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gym/envs/atari/atari_env.py", line 11, in <module>
    raise error.DependencyNotInstalled("{}. (HINT: you can install Atari dependencies by running 'pip install gym[atari]'.)".format(e))
gym.error.DependencyNotInstalled: No module named 'atari_py'. (HINT: you can install Atari dependencies by running 'pip install gym[atari]'.)

gym和cmake已经安装好

'atari_py' 在我的 pycharm IDE 中不起作用。在 terminal/command 行中尝试另一个 IDE 或 运行 文件。

我想也许你在pip中安装了atair,你可以尝试使用pip3 install。 python2 中的 importlib 似乎不兼容。

pip3 install atari-py

对我有用:)

检查 PyCharm IDE 中 atari_py 的版本,因为某些版本已被描述,因此它们不再工作或丢失文件 (ale_c.dll ) 我在使用 Python 安装 atari_py 和 gym 时遇到问题,因为我必须选择正确的所有版本才能正常工作。 Python atari_py 的最高版本 运行 是 3.7 (Python 3.7) 就 atari_py 而言,我使用的是 0.2.6 作为我无法在更高版本上工作。 Gym 导入 atari_py (atari-py) 但正如我之前所说,它已被描述,因此最新版本的 Gym 0.21.0(0.20.0 及更高版本)使用 ale-py,它的工作方式与它建议的略有不同不要做 env.render() 并且游戏是 v5(v5 以下的所有内容都来自 atari_py)。可悲的是,我无法让 Gym 0.21.0 和 ale-py 在单个游戏上正常工作,因为我发现的唯一游戏示例是:

import gym

env = gym.make('ALE/Breakout-v5',
    obs_type='rgb',                   # ram | rgb | grayscale
    frameskip=5,                     # frame skip
    mode=0,                           # game mode, see Machado et al. 2018
    difficulty=0,                     # game difficulty, see Machado et al. 2018
    repeat_action_probability=0.25,   # Sticky action probability
    full_action_space=True,           # Use all actions
    render_mode=None                  # None | human | rgb_array
)
  • 来自 https://brosa.ca/blog/ale-release-v0.7 并且游戏无法正常运行。 (意思是在渲染游戏时球不存在并且什么也没有发生 - 对于没有任何反应的较低版本的游戏也看到了同样的问题。)