2017-07-23 62 views
2

我嘗試在openAi健身房運行此代碼。但它不能。OpenAI健身房mujoco ImportError:沒有名爲'mujoco_py.mjlib'的模塊

import mujoco_py 
import gym 
from os.path import dirname 

env = gym.make('Hopper-v1') 
env.reset() 
for _ in range(1000): 
    env.render() 
    env.step(env.action_space.sample()) 

錯誤信息:

/Users/yunfanlu/anaconda/envs/py35/bin/python3.5 /Users/yunfanlu/WorkPlace/OpenAIGym/OpenGymL/c.py 
[2017-07-23 17:17:15,633] Making new env: Hopper-v1 
Traceback (most recent call last): 
    File "/Users/yunfanlu/anaconda/envs/py35/lib/python3.5/site-packages/gym/envs/mujoco/mujoco_env.py", line 12, in <module> 
    from mujoco_py.mjlib import mjlib 
ImportError: No module named 'mujoco_py.mjlib' 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "/Users/yunfanlu/WorkPlace/OpenAIGym/OpenGymL/c.py", line 15, in <module> 
    env = gym.make('Hopper-v1') 
    File "/Users/yunfanlu/anaconda/envs/py35/lib/python3.5/site-packages/gym/envs/registration.py", line 161, in make 
    return registry.make(id) 
    File "/Users/yunfanlu/anaconda/envs/py35/lib/python3.5/site-packages/gym/envs/registration.py", line 119, in make 
    env = spec.make() 
    File "/Users/yunfanlu/anaconda/envs/py35/lib/python3.5/site-packages/gym/envs/registration.py", line 85, in make 
    cls = load(self._entry_point) 
    File "/Users/yunfanlu/anaconda/envs/py35/lib/python3.5/site-packages/gym/envs/registration.py", line 17, in load 
    result = entry_point.load(False) 
    File "/Users/yunfanlu/anaconda/envs/py35/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 2258, in load 
    File "/Users/yunfanlu/anaconda/envs/py35/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 2264, in resolve 
    File "/Users/yunfanlu/anaconda/envs/py35/lib/python3.5/site-packages/gym/envs/mujoco/__init__.py", line 1, in <module> 
    from gym.envs.mujoco.mujoco_env import MujocoEnv 
    File "/Users/yunfanlu/anaconda/envs/py35/lib/python3.5/site-packages/gym/envs/mujoco/mujoco_env.py", line 14, in <module> 
    raise error.DependencyNotInstalled("{}. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/mujoco-py/.)".format(e)) 
gym.error.DependencyNotInstalled: No module named 'mujoco_py.mjlib'. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/mujoco-py/.) 

Process finished with exit code 1 

我的電腦ENVS:

OS:MacOS的 蟒蛇:python3.5(康達ENVS)

我有鴨舌安裝「PIP安裝'健身房[所有]'「並安裝mujoco。

➜ .mujoco tree 
. 
├── LICENSE.txt 
├── mjkey.txt 
└── mjpro150 

我可以運行mujoco的例子。它是成功的。

(py35) ➜ OpenGymL python body_interaction.py 
Creating window glfw 

謝謝。

回答

0

我有同樣的問題,它是由最近安裝的mujoco-py版本引起的,它與gym軟件包的mujoco環境不兼容。

該問題仍然存在,其詳細信息記錄在#80中。正如mach machutut的評論,更新在路線圖上,同時你可以使用0.5.7版本。

pip install mujoco-py==0.5.7 
相關問題