Python binding for MuJoCo physics library using mujoco

I want to use MuJoCo (http://www.mujoco.org/), an advanced physics simulator with python bindings (https://github.com/openai/mujoco-py).

I've got my MuJoCo license file mjkey.text and added the required paths MUJOCO_PY_MJKEY_PATH, MUJOCO_PY_MJPRO_PATH to the environment variables accordingly.

MUJOCO_PY_MJPRO_PATH = C:DropboxPhDMuJoComjpro131
MUJOCO_PY_MJKEY_PATH = C:DropboxPhDMuJoComjpro131bin

However, a soon as I want to import the libray with the following simple code,

import mujoco_py

I got the following error message.

C:DropboxPythonAnacondapython.exe
C:/Dropbox/PhD/Python/X/MujocoHelloWorld/test.py
Traceback (most recent call last):
  File "C:/Dropbox/PhD/Python/X/MujocoHelloWorld/test.py", line 1, in <module>
    import mujoco_py
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "C:DropboxPythonAnacondalibsite-packagesmujoco_py-0.5.4-py3.5.eggmujoco_py__init__.py", line 4, in <module>
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "C:DropboxPythonAnacondalibsite-packagesmujoco_py-0.5.4-py3.5.eggmujoco_pymjviewer.py", line 7, in <module>
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "C:DropboxPythonAnacondalibsite-packagesmujoco_py-0.5.4-py3.5.eggmujoco_pymjcore.py", line 6, in <module>
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "C:DropboxPythonAnacondalibsite-packagesmujoco_py-0.5.4-py3.5.eggmujoco_pymjlib.py", line 21, in <module>
  File "C:DropboxPythonAnacondalibctypes__init__.py", line 425, in LoadLibrary
    return self._dlltype(name)
  File "C:DropboxPythonAnacondalibctypes__init__.py", line 347, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

Process finished with exit code 1

I am using a Python 3.5.1 64-bit on a Windows 7 64-bit with MuJoCo 1.31 64-bit.

I guessed the problem is due to a some kind of incompatibility, I also tried Python 3.5.2 32-bit with MuJoCo 1.31 32-bit. Even, I tried the non-logical 32-bit Python and 64-bit MuJoCo combination and vice versa.

The already compiled given example "simulate.exe" in the MuJoCo library works perfectly. So, I guess there is no problem with the 64-bit MuJoCo library that I have. ( By the way, 32-bit version of it doesn't run on 64-bit Windows )

So, the problem should probably occur when loading the C++ library to Python. I debugged and at least checked that the Python code in mujoco_py library tries to load "mujoco131.lib" ( Not "mujoco131.dll" though ) from the correct path. And then the error occurs and code fails to run further.

I am open to any kind of comments and suggestions..

Cheers! And have a nice day!


Try editing mjlib.py , replacing "bin/mujoco131.lib" with "bin/mujoco131.dll" in the loader.

I also had to explicitly specify platname = "win" in platname_targdir.py

链接地址: http://www.djcxy.com/p/92798.html

上一篇: 碎片整理H264 NAL流(原始1722个avb数据包)

下一篇: 使用mujoco为MuJoCo物理库绑定Python