我该如何解决Open AI Gym安装问题?

时间:2020-09-05 07:14:33

标签: python pip conda reinforcement-learning openai-gym

git clone https://github.com/openai/gym
    cd gym
    pip install -e .

当我按照安装文档进行操作时,会引发此错误:

Failed to build box2d-py mujoco-py
DEPRECATION: Could not build wheels for box2d-py, mujoco-py which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: box2d-py, glfw, Cython, imageio, lockfile, mujoco-py, gym
    Running setup.py install for box2d-py ... error

我看到其他人也有同样的问题,但是他们建议我必须卸载python 2.7并仅使用python 3。 我已经检查了我的python版本,它只有3.7版本,没有其他版本可用,因此有人可以帮助我。

ERROR: Command errored out with exit status 1:
   command: 'c:\users\m\.conda\envs\tensorflow\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MITHIL~1\\AppData\\Local\\Temp\\pip-install-6ozh5a9c\\box2d-py\\setup.py'"'"'; __file__='"'"'C:\\Users\\m1\\AppData\\Local\\Temp\\pip-install-6ozh5a9c\\box2d-py\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\M~1\AppData\Local\Temp\pip-wheel-gruiq9b6'
       cwd: C:\Users\M~1\AppData\Local\Temp\pip-install-6ozh5a9c\box2d-py\
  Complete output (16 lines):
  Using setuptools (version 49.6.0.post20200814).
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.7
  creating build\lib.win-amd64-3.7\Box2D
  copying library\Box2D\Box2D.py -> build\lib.win-amd64-3.7\Box2D
  copying library\Box2D\__init__.py -> build\lib.win-amd64-3.7\Box2D
  creating build\lib.win-amd64-3.7\Box2D\b2
  copying library\Box2D\b2\__init__.py -> build\lib.win-amd64-3.7\Box2D\b2
  running build_ext
  building 'Box2D._Box2D' extension
  swigging Box2D\Box2D.i to Box2D\Box2D_wrap.cpp
  swig.exe -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.exe' failed: No such file or directory
  ----------------------------------------
  ERROR: Failed building wheel for box2d-py
  Running setup.py clean for box2d-py
Failed to build box2d-py
Installing collected packages: box2d-py
    Running setup.py install for box2d-py ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\m\.conda\envs\tensorflow\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\M~1\\AppData\\Local\\Temp\\pip-install-6ozh5a9c\\box2d-py\\setup.py'"'"'; __file__='"'"'C:\\Users\\M~1\\AppData\\Local\\Temp\\pip-install-6ozh5a9c\\box2d-py\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\M~1\AppData\Local\Temp\pip-record-67o7g705\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\m\.conda\envs\tensorflow\Include\box2d-py'
         cwd: C:\Users\M~1\AppData\Local\Temp\pip-install-6ozh5a9c\box2d-py\
    Complete output (16 lines):
    Using setuptools (version 49.6.0.post20200814).
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\Box2D
    copying library\Box2D\Box2D.py -> build\lib.win-amd64-3.7\Box2D
    copying library\Box2D\__init__.py -> build\lib.win-amd64-3.7\Box2D
    creating build\lib.win-amd64-3.7\Box2D\b2
    copying library\Box2D\b2\__init__.py -> build\lib.win-amd64-3.7\Box2D\b2
    running build_ext
    building 'Box2D._Box2D' extension
    swigging Box2D\Box2D.i to Box2D\Box2D_wrap.cpp
    swig.exe -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.exe' failed: No such file or directory
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\m\.conda\envs\tensorflow\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MITHIL~1\\AppData\\Local\\Temp\\pip-install-6ozh5a9c\\box2d-py\\setup.py'"'"'; __file__='"'"'C:\\Users\\M~1\\AppData\\Local\\Temp\\pip-install-6ozh5a9c\\box2d-py\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\M~1\AppData\Local\Temp\pip-record-67o7g705\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\m\.conda\envs\tensorflow\Include\box2d-py' 
Check the logs for full command output

2 个答案:

答案 0 :(得分:4)

试试这个:

<块引用>

pip installgym==0.7.4

这是一个精简版。

答案 1 :(得分:0)

您可能还需要运行以下命令:

$ apt-get install -y libglu1-mesa-dev libgl1-mesa-dev libosmesa6-dev xvfb ffmpeg curl patchelf libglfw3 libglfw3-dev cmake zlib1g zlib1g-dev swig