今天安装mujoco-py的时候,遇见了下面的错误:

  v2 pip install mujoco-py
Looking in indexes: http://pip.baidu.com/root/baidu/+simple/
Collecting mujoco-py
Downloading http://pip.baidu.com/root/baidu/packages/packages/2f/48/b108057c1a23c8da9f4cdc7a7c46ab7cec49c3563c0706d50f2527de6ba0/mujoco-py-2.0.2.13.tar.gz (792kB)
|████████████████████████████████| 798kB 2.8MB/s
Installing build dependencies ... done
WARNING: Missing build requirements in pyproject.toml for mujoco-py from http://pip.baidu.com/root/baidu/packages/packages/2f/48/b108057c1a23c8da9f4cdc7a7c46ab7cec49c3563c0706d50f2527de6ba0/mujoco-py-2.0.2.13.tar.gz#sha256=d6ae66276b565af9063597fda70683a89c7356290f5ac3961b794ee90ec50eea.
WARNING: The project does not specify a build backend, and pip cannot fall back to setuptools without 'wheel'.
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing wheel metadata ... done
Requirement already satisfied: numpy>=1.11 in /Users/wugaosheng/anaconda3/lib/python3.7/site-packages (from mujoco-py) (1.16.4)
Requirement already satisfied: imageio>=2.1.2 in /Users/wugaosheng/anaconda3/lib/python3.7/site-packages (from mujoco-py) (2.5.0)
Requirement already satisfied: cffi>=1.10 in /Users/wugaosheng/anaconda3/lib/python3.7/site-packages (from mujoco-py) (1.12.3)
Collecting fasteners~=0.15 (from mujoco-py)
Downloading http://pip.baidu.com/root/baidu/packages/packages/78/20/c862d765287e9e8b29f826749ebae8775bdca50b2cb2ca079346d5fbfd76/fasteners-0.16-py2.py3-none-any.whl
Requirement already satisfied: Cython>=0.27.2 in /Users/wugaosheng/anaconda3/lib/python3.7/site-packages (from mujoco-py) (0.29.12)
Requirement already satisfied: glfw>=1.4.0 in /Users/wugaosheng/anaconda3/lib/python3.7/site-packages (from mujoco-py) (2.1.0)
Requirement already satisfied: pycparser in /Users/wugaosheng/anaconda3/lib/python3.7/site-packages (from cffi>=1.10->mujoco-py) (2.19)
Requirement already satisfied: six in /Users/wugaosheng/anaconda3/lib/python3.7/site-packages (from fasteners~=0.15->mujoco-py) (1.12.0)
Building wheels for collected packages: mujoco-py
Building wheel for mujoco-py (PEP 517) ... error
ERROR: Complete output from command /Users/wugaosheng/anaconda3/bin/python /Users/wugaosheng/anaconda3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/mf/bv3nk1394f3c6y19kqgsrfn80000gn/T/tmpv1utl178:
ERROR: running bdist_wheel
running build

You appear to be missing MuJoCo. We expected to find the file here: /Users/wugaosheng/.mujoco/mujoco200

This package only provides python bindings, the library must be installed separately.

Please follow the instructions on the README to install MuJoCo

https://github.com/openai/mujoco-py#install-mujoco

Which can be downloaded from the website

https://www.roboti.us/index.html

Traceback (most recent call last):
File "/Users/wugaosheng/anaconda3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
main()
File "/Users/wugaosheng/anaconda3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/wugaosheng/anaconda3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 141, in build_wheel
metadata_directory)
File "/private/var/folders/mf/bv3nk1394f3c6y19kqgsrfn80000gn/T/pip-build-env-d3fgj8ug/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 217, in build_wheel
wheel_directory, config_settings)
File "/private/var/folders/mf/bv3nk1394f3c6y19kqgsrfn80000gn/T/pip-build-env-d3fgj8ug/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 202, in _build_with_temp_dir
self.run_setup()
File "/private/var/folders/mf/bv3nk1394f3c6y19kqgsrfn80000gn/T/pip-build-env-d3fgj8ug/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 254, in run_setup
self).run_setup(setup_script=setup_script)
File "/private/var/folders/mf/bv3nk1394f3c6y19kqgsrfn80000gn/T/pip-build-env-d3fgj8ug/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 145, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 51, in <module>
'Programming Language :: Python :: 3 :: Only',
File "/private/var/folders/mf/bv3nk1394f3c6y19kqgsrfn80000gn/T/pip-build-env-d3fgj8ug/overlay/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/Users/wugaosheng/anaconda3/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Users/wugaosheng/anaconda3/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Users/wugaosheng/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/private/var/folders/mf/bv3nk1394f3c6y19kqgsrfn80000gn/T/pip-build-env-d3fgj8ug/normal/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/Users/wugaosheng/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Users/wugaosheng/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "setup.py", line 29, in run
import mujoco_py # noqa: force build
File "/private/var/folders/mf/bv3nk1394f3c6y19kqgsrfn80000gn/T/pip-install-700dauyl/mujoco-py/mujoco_py/__init__.py", line 3, in <module>
from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
File "/private/var/folders/mf/bv3nk1394f3c6y19kqgsrfn80000gn/T/pip-install-700dauyl/mujoco-py/mujoco_py/builder.py", line 509, in <module>
mujoco_path, key_path = discover_mujoco()
File "/private/var/folders/mf/bv3nk1394f3c6y19kqgsrfn80000gn/T/pip-install-700dauyl/mujoco-py/mujoco_py/utils.py", line 93, in discover_mujoco
raise Exception(message)
Exception:
You appear to be missing MuJoCo. We expected to find the file here: /Users/wugaosheng/.mujoco/mujoco200

This package only provides python bindings, the library must be installed separately.

Please follow the instructions on the README to install MuJoCo

https://github.com/openai/mujoco-py#install-mujoco

Which can be downloaded from the website

https://www.roboti.us/index.html

----------------------------------------
ERROR: Failed building wheel for mujoco-py
Running setup.py clean for mujoco-py
Failed to build mujoco-py
ERROR: Could not build wheels for mujoco-py which use PEP 517 and

解决方法

pip install mujoco_py==2.0.2.8

参考文献

​ERROR: Could not build wheels for mujoco-py which use PEP 517 and cannot be installed directly​