Ubuntu 21.10 install gym, failed to install box2d-py

Building wheel for box2d-py (setup.py) ... error
  ERROR: Command errored out with exit status 1:

ERROR: 

Building wheel for box2d-py (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/hsy/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fnnlwo2g/box2d-py_6948c8f752ad42eca50020e1ea466ebc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fnnlwo2g/box2d-py_6948c8f752ad42eca50020e1ea466ebc/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__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-pqfze13u
       cwd: /tmp/pip-install-fnnlwo2g/box2d-py_6948c8f752ad42eca50020e1ea466ebc/
  Complete output (16 lines):
  Using setuptools (version 58.0.4).
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/Box2D
  copying library/Box2D/__init__.py -> build/lib.linux-x86_64-3.9/Box2D
  copying library/Box2D/Box2D.py -> build/lib.linux-x86_64-3.9/Box2D
  creating build/lib.linux-x86_64-3.9/Box2D/b2
  copying library/Box2D/b2/__init__.py -> build/lib.linux-x86_64-3.9/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
  ----------------------------------------
  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: /home/hsy/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fnnlwo2g/box2d-py_6948c8f752ad42eca50020e1ea466ebc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fnnlwo2g/box2d-py_6948c8f752ad42eca50020e1ea466ebc/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__, '"'"'exec'"'"'))' install --record /tmp/pip-record-jsd27xvl/install-record.txt --single-version-externally-managed --compile --install-headers /home/hsy/anaconda3/include/python3.9/box2d-py
         cwd: /tmp/pip-install-fnnlwo2g/box2d-py_6948c8f752ad42eca50020e1ea466ebc/
    Complete output (16 lines):
    Using setuptools (version 58.0.4).
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/Box2D
    copying library/Box2D/__init__.py -> build/lib.linux-x86_64-3.9/Box2D
    copying library/Box2D/Box2D.py -> build/lib.linux-x86_64-3.9/Box2D
    creating build/lib.linux-x86_64-3.9/Box2D/b2
    copying library/Box2D/b2/__init__.py -> build/lib.linux-x86_64-3.9/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
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/hsy/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fnnlwo2g/box2d-py_6948c8f752ad42eca50020e1ea466ebc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fnnlwo2g/box2d-py_6948c8f752ad42eca50020e1ea466ebc/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__, '"'"'exec'"'"'))' install --record /tmp/pip-record-jsd27xvl/install-record.txt --single-version-externally-managed --compile --install-headers /home/hsy/anaconda3/include/python3.9/box2d-py Check the logs for full command output.


 

sloution:

run:

sudo apt-get install swig build-essential python-dev python3-dev

then run

pip3 install box2d-py -i https://pypi.tuna.tsinghua.edu.cn/simple

source: 

https://stackoverflow.com/questions/51811263/problems-pip-installing-box2d

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值