安装mujoco_py之后测试examples中的body_interaction.py遇到以下问题:
1.cython问题
Cython.Compiler.Errors.CompileError: /home/usr/.local/lib/python3.8/site-packages/mujoco_py/cymj.pyx
解决:cython换了一个版本。
pip uninstall cython
pip install cython==0.29.21
2.X11/Xlib.h:没有该文件或目录
解决:
sudo apt-get install libx11-dev
3.fatal error: GL/glew.h: 没有那个文件或目录
解决:输入
sudo apt-cache search glew
会给出glew的版本列表,我的是这些:
glewlwyd-common - OAuth2 authentication server providing Json Web Tokens - common files
fonts-glewlwyd - OAuth2 authentication server providing Json Web Tokens - font files
glew-utils - OpenGL Extension Wrangler - utilities
glewlwyd - OAuth2 authentication server providing Json Web Tokens
libglew-dev - OpenGL Extension Wrangler - development environment
libglew2.1 - OpenGL Extension Wrangler - runtime environment
libglewmx-dev - OpenGL Extension Wrangler MX - development environment
libglewmx1.13 - OpenGL Extension Wrangler (Multiple Rendering Contexts)
然后只要sudo apt install列出的每一个包就行了,对我这个就是:
sudo apt install glewlwyd-common
sudo apt install fonts-glewlwyd
sudo apt install glew-utils
sudo apt install glewlwyd
sudo apt install libglew-dev
sudo apt install libglew2.1
sudo apt install libglewmx-dev
sudo apt install libglewmx1.13
4.FileNotFoundError: [Errno 2] No such file or directory: 'patchelf'
解决:
sudo apt-get update -y
sudo apt-get install -y patchelf
然后就能顺利运行了!
在安装gym的时候也遇到报错:
Building wheels for collected packages: box2d-py, gym
Building wheel for box2d-py (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
Using setuptools (version 68.0.0).
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
creating build/lib.linux-x86_64-cpython-38/Box2D
copying library/Box2D/Box2D.py -> build/lib.linux-x86_64-cpython-38/Box2D
copying library/Box2D/__init__.py -> build/lib.linux-x86_64-cpython-38/Box2D
creating build/lib.linux-x86_64-cpython-38/Box2D/b2
copying library/Box2D/b2/__init__.py -> build/lib.linux-x86_64-cpython-38/Box2D/b2
running build_ext
building 'Box2D._Box2D' extension
swigging Box2D/Box2D.i to Box2D/Box2D_wrap.cpp
swig -python -c++ -IBox2D -small -O -includeall -ignoremissing -w201 -globals b2Globals -outdir library/Box2D -keyword -w511 -D_SWIG_KWARGS -o Box2D/Box2D_wrap.cpp Box2D/Box2D.i
error: command 'swig' failed: No such file or directory
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for box2d-py
Running setup.py clean for box2d-py
Building editable for gym (pyproject.toml) ... done
Created wheel for gym: filename=gym-0.26.2-0.editable-py3-none-any.whl size=4276 sha256=d500f2aace1313b1e6edeef6688a35cd77a0fe742c6e746285ae58b582fc207b
Stored in directory: /tmp/pip-ephem-wheel-cache-1rf846yu/wheels/ee/8a/f5/ed98d4005e8172d461a18b6aa8147e52bb0a5dad276b12a2c2
Successfully built gym
Failed to build box2d-py
ERROR: Could not build wheels for box2d-py, which is required to install pyproject.toml-based projects
解决:
sudo apt-get install swig build-essential python-dev python3-dev
pip install -e .[all]
成功安装无报错。