安装 Box2D Python 包时出错

安装 Box2D Python 包时出错

我正在尝试在 Windows 10 中安装 OpenAI 的 Gym,根据这个文章

我按照大部分步骤操作都没有问题。但是在使用 安装的步骤中Box2Dpip我收到以下错误。MyEnv是我当前的 conda 环境。我该如何解决这个问题?

(MyEnv) C:\Users\me>pip install Box2D
Collecting Box2D
  Using cached https://files.pythonhosted.org/packages/cc/7b/ddb96fea1fa5b24f8929714ef483f64c33e9649e7aae066e5f5023ea426a/Box2D-2.3.2.tar.gz
Building wheels for collected packages: Box2D
  Building wheel for Box2D (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\me\\AppData\\Local\\Temp\\pip-install-v1w5reok\\Box2D\\setup.py'"'"'; __file__='"'"'C:\\Users\\me\\AppData\\Local\\Temp\\pip-install-v1w5reok\\Box2D\\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\me\AppData\Local\Temp\pip-wheel-58bpeewu' --python-tag cp37
       cwd: C:\Users\me\AppData\Local\Temp\pip-install-v1w5reok\Box2D\
  Complete output (338 lines):
  Using setuptools (version 41.2.0).
  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
  C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\Library\bin\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
  Box2D\Common\b2Math.h(67) : Warning 302: Identifier 'b2Vec2' redefined by %extend (ignored),
  Box2D\Box2D_math.i(47) : Warning 302: %extend definition of 'b2Vec2'.
  Box2D\Common\b2Math.h(158) : Warning 302: Identifier 'b2Vec3' redefined by %extend (ignored),
  Box2D\Box2D_math.i(168) : Warning 302: %extend definition of 'b2Vec3'.
  Box2D\Common\b2Math.h(197) : Warning 302: Identifier 'b2Mat22' redefined by %extend (ignored),
  Box2D\Box2D_math.i(301) : Warning 302: %extend definition of 'b2Mat22'.
  Box2D\Common\b2Math.h(271) : Warning 302: Identifier 'b2Mat33' redefined by %extend (ignored),
  Box2D\Box2D_math.i(372) : Warning 302: %extend definition of 'b2Mat33'.
  Box2D\Collision\b2DynamicTree.h(44) : Warning 312: Nested union not currently supported (ignored).
  Box2D\Common\b2Settings.h(144) : Warning 506: Can't wrap varargs with keyword arguments enabled
  Box2D\Common\b2Math.h(91) : Warning 509: Overloaded method b2Vec2::operator ()(int32) effectively ignored,
  Box2D\Common\b2Math.h(85) : Warning 509: as it is shadowed by b2Vec2::operator ()(int32) const.
  creating build\temp.win-amd64-3.7
  creating build\temp.win-amd64-3.7\Release
  creating build\temp.win-amd64-3.7\Release\box2d
  creating build\temp.win-amd64-3.7\Release\box2d\dynamics
  creating build\temp.win-amd64-3.7\Release\box2d\dynamics\contacts
  creating build\temp.win-amd64-3.7\Release\box2d\dynamics\joints
  creating build\temp.win-amd64-3.7\Release\box2d\common
  creating build\temp.win-amd64-3.7\Release\box2d\collision
  creating build\temp.win-amd64-3.7\Release\box2d\collision\shapes
  C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\Library\mingw-w64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -IC:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\include -IC:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\include -c Box2D\Box2D_wrap.cpp -o build\temp.win-amd64-3.7\Release\box2d\box2d_wrap.o -I.
  Box2D\Box2D_wrap.cpp: In function 'bool b2CheckVertices(b2Vec2*, int32, bool)':
  Box2D\Box2D_wrap.cpp:3760:16: warning: variable 'm_centroid' set but not used [-Wunused-but-set-variable]
           b2Vec2 m_centroid = __b2ComputeCentroid(vertices, count);
                  ^
  Box2D\Box2D_wrap.cpp: In function 'long int b2ContactPoint___hash__(b2ContactPoint*)':
  Box2D\Box2D_wrap.cpp:4181:77: error: cast from 'b2ContactPoint*' to 'long int' loses precision [-fpermissive]
   SWIGINTERN long b2ContactPoint___hash__(b2ContactPoint *self){ return (long)self; }
                                                                               ^
  Box2D\Box2D_wrap.cpp: In function 'long int b2AssertException___hash__(b2AssertException*)':
  Box2D\Box2D_wrap.cpp:4205:83: error: cast from 'b2AssertException*' to 'long int' loses precision [-fpermissive]
   SWIGINTERN long b2AssertException___hash__(b2AssertException *self){ return (long)self; }

<lots of errors from Box2D_wrap.cpp>
                                                                           ^
  error: command 'C:\\Users\\me\\AppData\\Local\\Continuum\\anaconda3\\envs\\COBRA\\Library\\mingw-w64\\bin\\gcc.exe' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for Box2D
  Running setup.py clean for Box2D
Failed to build Box2D
Installing collected packages: Box2D
  Running setup.py install for Box2D ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\me\\AppData\\Local\\Temp\\pip-install-v1w5reok\\Box2D\\setup.py'"'"'; __file__='"'"'C:\\Users\\me\\AppData\\Local\\Temp\\pip-install-v1w5reok\\Box2D\\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\me\AppData\Local\Temp\pip-record-7ni40amu\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\me\AppData\Local\Temp\pip-install-v1w5reok\Box2D\
    Complete output (338 lines):
    Using setuptools (version 41.2.0).
    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
    C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\Library\bin\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
    Box2D\Common\b2Math.h(67) : Warning 302: Identifier 'b2Vec2' redefined by %extend (ignored),
    Box2D\Box2D_math.i(47) : Warning 302: %extend definition of 'b2Vec2'.
    Box2D\Common\b2Math.h(158) : Warning 302: Identifier 'b2Vec3' redefined by %extend (ignored),
    Box2D\Box2D_math.i(168) : Warning 302: %extend definition of 'b2Vec3'.
    Box2D\Common\b2Math.h(197) : Warning 302: Identifier 'b2Mat22' redefined by %extend (ignored),
    Box2D\Box2D_math.i(301) : Warning 302: %extend definition of 'b2Mat22'.
    Box2D\Common\b2Math.h(271) : Warning 302: Identifier 'b2Mat33' redefined by %extend (ignored),
    Box2D\Box2D_math.i(372) : Warning 302: %extend definition of 'b2Mat33'.
    Box2D\Collision\b2DynamicTree.h(44) : Warning 312: Nested union not currently supported (ignored).
    Box2D\Common\b2Settings.h(144) : Warning 506: Can't wrap varargs with keyword arguments enabled
    Box2D\Common\b2Math.h(91) : Warning 509: Overloaded method b2Vec2::operator ()(int32) effectively ignored,
    Box2D\Common\b2Math.h(85) : Warning 509: as it is shadowed by b2Vec2::operator ()(int32) const.
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\box2d
    creating build\temp.win-amd64-3.7\Release\box2d\dynamics
    creating build\temp.win-amd64-3.7\Release\box2d\dynamics\contacts
    creating build\temp.win-amd64-3.7\Release\box2d\dynamics\joints
    creating build\temp.win-amd64-3.7\Release\box2d\common
    creating build\temp.win-amd64-3.7\Release\box2d\collision
    creating build\temp.win-amd64-3.7\Release\box2d\collision\shapes
    C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\Library\mingw-w64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -IC:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\include -IC:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\include -c Box2D\Box2D_wrap.cpp -o build\temp.win-amd64-3.7\Release\box2d\box2d_wrap.o -I.
    Box2D\Box2D_wrap.cpp: In function 'bool b2CheckVertices(b2Vec2*, int32, bool)':
    Box2D\Box2D_wrap.cpp:3760:16: warning: variable 'm_centroid' set but not used [-Wunused-but-set-variable]
             b2Vec2 m_centroid = __b2ComputeCentroid(vertices, count);
                    ^
<lots of errors from Box2D_wrap.cpp>
                                                                           ^
    error: command 'C:\\Users\\me\\AppData\\Local\\Continuum\\anaconda3\\envs\\COBRA\\Library\\mingw-w64\\bin\\gcc.exe' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\me\AppData\Local\Continuum\anaconda3\envs\COBRA\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\me\\AppData\\Local\\Temp\\pip-install-v1w5reok\\Box2D\\setup.py'"'"'; __file__='"'"'C:\\Users\\me\\AppData\\Local\\Temp\\pip-install-v1w5reok\\Box2D\\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\me\AppData\Local\Temp\pip-record-7ni40amu\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

(MyEnv) C:\Users\me>

相关内容