运行OpenAI Universe示例

时间:2017-01-25 13:17:11

标签: python python-3.x openai-gym

当我尝试从here运行以下示例代码时,Python无法找到remote_manager属性。我已经安装了所有必需的软件包,OpenAI gym examples似乎可以正常工作。

我在Linux Mint 18下运行Python 3.5,我从pip存储库获得了OpenAI gym和universe。

import gym
import universe # register Universe environments into Gym

env = gym.make('flashgames.DuskDrive-v0') # any Universe environment ID here
observation_n = env.reset()

while True:
  # agent which presses the Up arrow 60 times per second
  action_n = [[('KeyEvent', 'ArrowUp', True)] for _ in observation_n]
  observation_n, reward_n, done_n, info = env.step(action_n)
  env.render()

完整的堆栈跟踪是

[2017-01-25 14:04:05,416] Making new env: flashgames.DuskDrive-v0
Traceback (most recent call last):
  File "/home/mark/projects/development-playground/src/utils/openai_experiments.py", line 5, in <module>
observation_n = env.reset()
  File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 123, in reset
observation = self._reset()
  File "/usr/local/lib/python3.5/dist-packages/universe/wrappers/timer.py", line 15, in _reset
return self.env.reset()
  File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 123, in reset
observation = self._reset()
  File "/usr/local/lib/python3.5/dist-packages/universe/wrappers/render.py", line 25, in _reset
observation_n = self.env.reset()
  File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 123, in reset
observation = self._reset()
  File "/usr/local/lib/python3.5/dist-packages/universe/wrappers/throttle.py", line 42, in _reset
observation = self.env.reset()
  File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 123, in reset
observation = self._reset()
  File "/usr/local/lib/python3.5/dist-packages/universe/envs/vnc_env.py", line 331, in _reset
self._handle_connect()
  File "/usr/local/lib/python3.5/dist-packages/universe/envs/vnc_env.py", line 498, in _handle_connect
for remote in self.remote_manager.pop(n=n):
AttributeError: 'VNCEnv' object has no attribute 'remote_manager'

1 个答案:

答案 0 :(得分:4)

您忘记调用env.configure()

env = gym.make('flashgames.DuskDrive-v0')
env.configure(remotes=1)
observation_n = env.reset()