我目前正在尝试使用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。