简体   繁体   English

尽管出现以下错误,我如何安装gym[box2d]?

[英]how can i install gym[box2d] despite errors below?

when i try to install gym[box2d] i get following error: i tried: pip install gym[box2d].当我尝试安装gym[box2d]时出现以下错误:我试过:pip install gym[box2d]。 on anaconda prompt i installed swig and gym[box2d] but i code in python3.9 env and it still not working.(my text editor is pycharm) gym is already installed.and在 anaconda 提示符下,我安装了 swig 和 gym[box2d] 但我在 python3.9 env 中编码,它仍然无法正常工作。(我的文本编辑器是 pycharm)gym 已经安装。并且

ERROR: Command errored out with exit status 1:
   command: 'C:\Users\hooman\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\hoom
an\\AppData\\Local\\Temp\\pip-install-_vo0km5i\\box2d-py_aea38b0da25341cf93e6a6c9d4b9d296\\setup.py'"'"'; __file__='"'"'C:\\Users\\hooman\\AppData\\Local\\Temp\\pi
p-install-_vo0km5i\\box2d-py_aea38b0da25341cf93e6a6c9d4b9d296\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else
 io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exe
c'"'"'))' bdist_wheel -d 'C:\Users\hooman\AppData\Local\Temp\pip-wheel-va_dgazk'
       cwd: C:\Users\hooman\AppData\Local\Temp\pip-install-_vo0km5i\box2d-py_aea38b0da25341cf93e6a6c9d4b9d296\
  Complete output (16 lines):
  Using setuptools (version 58.2.0).
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\Box2D
  copying library\Box2D\Box2D.py -> build\lib.win-amd64-3.9\Box2D
  copying library\Box2D\__init__.py -> build\lib.win-amd64-3.9\Box2D
  creating build\lib.win-amd64-3.9\Box2D\b2
  copying library\Box2D\b2\__init__.py -> build\lib.win-amd64-3.9\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_wr
ap.cpp Box2D\Box2D.i
  error: command 'swig.exe' failed: None
  ----------------------------------------
  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\hooman\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ho
oman\\AppData\\Local\\Temp\\pip-install-_vo0km5i\\box2d-py_aea38b0da25341cf93e6a6c9d4b9d296\\setup.py'"'"'; __file__='"'"'C:\\Users\\hooman\\AppData\\Local\\Temp\\
pip-install-_vo0km5i\\box2d-py_aea38b0da25341cf93e6a6c9d4b9d296\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) el
se io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'e
xec'"'"'))' install --record 'C:\Users\hooman\AppData\Local\Temp\pip-record-yz4t1mq0\install-record.txt' --single-version-externally-managed --compile --install-he
aders 'C:\Users\hooman\AppData\Local\Programs\Python\Python39\Include\box2d-py'
         cwd: C:\Users\hooman\AppData\Local\Temp\pip-install-_vo0km5i\box2d-py_aea38b0da25341cf93e6a6c9d4b9d296\
    Complete output (16 lines):
    Using setuptools (version 58.2.0).
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.9
    creating build\lib.win-amd64-3.9\Box2D
    copying library\Box2D\Box2D.py -> build\lib.win-amd64-3.9\Box2D
    copying library\Box2D\__init__.py -> build\lib.win-amd64-3.9\Box2D
    creating build\lib.win-amd64-3.9\Box2D\b2
    copying library\Box2D\b2\__init__.py -> build\lib.win-amd64-3.9\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: None
    ----------------------------------------
ERROR: Command errored out with exit status 1: 

according to Anaconda , you should use the following command根据Anaconda ,您应该使用以下命令

conda install -c conda-forge gym-box2d

but you can still just install gym and from gym.envs import box2d但你仍然可以只安装gymfrom gym.envs import box2d

I think you are using windows for using openai gym which is not officially supported.我认为您正在使用 windows 来使用不受官方支持的 openai 健身房。 gym installation for windows is not stable. windows 的健身房安装不稳定。 Linux and mac are officially supported.官方支持 Linux 和 mac。 I recommended this video Installing OpenAI Gym (gym[all]) on Linux, Windows and Mac for installing in Linux.我推荐这个视频在 Linux、Windows 和 Mac 上安装 OpenAI Gym (gym[all])以安装在 Linux 上。 you can use wsl2 in windows which i tried and worked.您可以在我尝试并工作的 windows 中使用 wsl2。

Also this doc gym 0.7.4 helped me to set up the display in using wsl2(alias linux server according to the docs ).此外,这个 doc gym 0.7.4帮助我使用 wsl2 设置显示(根据文档别名 linux 服务器)。

Individual installation like box2d did not work for me.像 box2d 这样的单独安装对我不起作用。 Try to install all gym envs as said in the video(takes a lot of space but no other option)尝试按照视频中的说明安装所有健身房环境(占用大量空间,但没有其他选择)

I think you may go to https://www.lfd.uci.edu/~gohlke/pythonlibs/ and find pybox2d and download the version which match your python version and run pip install Box2D‑2.3.10‑cp38‑cp38‑win_amd64.whl (change your wheel name!) I think you may go to https://www.lfd.uci.edu/~gohlke/pythonlibs/ and find pybox2d and download the version which match your python version and run pip install Box2D‑2.3.10‑cp38‑cp38‑win_amd64.whl (更改您的车轮名称!)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM