安装Mujoco可以根据此教程(https://blog.csdn.net/Youtian_/article/details/103841453),但是会出现问题,以下方案可以解决。
出现的问题:
1.ubuntu18 Could not build wheels for mujoco-py which use PEP 517 and cannot be installed directly
2. error: command ‘gcc’ failed with exit status 1
3. error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1
解决问题
1,确保GCC已经安装。
解决问题2和3:
sudo apt-get install python-dev
或者用这个:
apt-get install python-dev
解决GCC问题:如 distutils.errors.DistutilsExecError: command ‘gcc’ failed with exit status 1等GCC问题,运行如下代码:
sudo apt-get install libgl1-mesa-dev libgl1-mesa-glx libosmesa6-dev
2,先安装
sudo apt-get install python3.7-dev
sudo apt-get install build-essential python3-dev libssl-dev libffi-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev
发现还是解决不了问题,执行步骤3。
3,再安装
sudo apt-get install python3-dev
sudo apt-get install libevent-dev
sudo apt-get install libosmesa6-dev
sudo apt-get update -y
sudo apt-get install -y patchelf
之前网上有人说用:pip3 install --no-use-pep517 ‘mujoco-py<2.1,>=2.0’.
,但是我试过了,并不能解决问题。
完成上述步骤,基本可以解决问题。
4,如果还没解决:
用下面的命令,
pip install mujoco_py==2.0.2.8
此外,如果出现mpi4y问题可以参考此资料:https://bitbucket.org/mpi4py/mpi4py/issues/179/sudo-pip-install-mpi4py-and-get-the
参考资料:
[1] https://github.com/openai/mujoco-py
[2] https://stackoverflow.com/questions/26053982/setup-script-exited-with-error-command-x86-64-linux-gnu-gcc-failed-with-exit
[3] https://github.com/openai/mujoco-py/issues/492
[4] https://stackoverflow.com/questions/11094718/error-command-gcc-failed-with-exit-status-1-while-installing-eventlet
[5] https://blog.csdn.net/coder_Gray/article/details/77189002
[6] https://blog.csdn.net/Youtian_/article/details/103841453