Ubuntu20.04安装mujoco时遇到的问题及解决

本文详细描述了解决在使用mujoco_py库时遇到的cython版本问题、X11/Xlib.h缺失、GL/glew.h文件找不到、patchelfFileNotFoundError以及gym安装过程中Box2D构建错误的步骤。通过apt-get和pip安装相关依赖包得以成功解决。
摘要由CSDN通过智能技术生成

安装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]

成功安装无报错。

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值