我严格遵守setup tutorial provided by gym,但是运行pip install -e '.[all]'
时收到错误消息
或pip install -e '.[box2d]'
Running setup.py bdist_wheel for box2d-py ... error
Complete output from command /home/aptx/anaconda3/envs/rl/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-rx9l74ei/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 /tmp/pip-wheel-r9et1nxi --python-tag cp35:
Using setuptools (version 39.1.0).
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/Box2D
copying library/Box2D/__init__.py -> build/lib.linux-x86_64-3.5/Box2D
copying library/Box2D/Box2D.py -> build/lib.linux-x86_64-3.5/Box2D
creating build/lib.linux-x86_64-3.5/Box2D/b2
copying library/Box2D/b2/__init__.py -> build/lib.linux-x86_64-3.5/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
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.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/Box2D
creating build/temp.linux-x86_64-3.5/Box2D/Dynamics
creating build/temp.linux-x86_64-3.5/Box2D/Dynamics/Contacts
creating build/temp.linux-x86_64-3.5/Box2D/Dynamics/Joints
creating build/temp.linux-x86_64-3.5/Box2D/Common
creating build/temp.linux-x86_64-3.5/Box2D/Collision
creating build/temp.linux-x86_64-3.5/Box2D/Collision/Shapes
gcc -pthread -B /home/aptx/anaconda3/envs/rl/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/aptx/anaconda3/envs/rl/include/python3.5m -c Box2D/Box2D_wrap.cpp -o build/temp.linux-x86_64-3.5/Box2D/Box2D_wrap.o -I. -Wno-unused
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
gcc -pthread -B /home/aptx/anaconda3/envs/rl/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/aptx/anaconda3/envs/rl/include/python3.5m -c Box2D/Dynamics/b2WorldCallbacks.cpp -o build/temp.linux-x86_64-3.5/Box2D/Dynamics/b2WorldCallbacks.o -I. -Wno-unused
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
gcc -pthread -B /home/aptx/anaconda3/envs/rl/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/aptx/anaconda3/envs/rl/include/python3.5m -c Box2D/Dynamics/Contacts/b2ContactSolver.cpp -o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Contacts/b2ContactSolver.o -I. -Wno-unused
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
Box2D/Dynamics/Contacts/b2ContactSolver.cpp: In member function ‘bool b2ContactSolver::SolvePositionConstraints()’:
Box2D/Dynamics/Contacts/b2ContactSolver.cpp:713:51: warning: ‘psm.b2PositionSolverManifold::separation’ may be used uninitialized in this function [-Wmaybe-uninitialized]
float32 C = b2Clamp(b2_baumgarte * (separation + b2_linearSlop), -b2_maxLinearCorrection, 0.0f);
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
gcc -pthread -B /home/aptx/anaconda3/envs/rl/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/aptx/anaconda3/envs/rl/include/python3.5m -c Box2D/Collision/Shapes/b2EdgeShape.cpp -o build/temp.linux-x86_64-3.5/Box2D/Collision/Shapes/b2EdgeShape.o -I. -Wno-unused
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
g++ -pthread -shared -L/home/aptx/anaconda3/envs/rl/lib -B /home/aptx/anaconda3/envs/rl/compiler_compat -Wl,-rpath=/home/aptx/anaconda3/envs/rl/lib,--no-as-needed build/temp.linux-x86_64-3.5/Box2D/Box2D_wrap.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/b2WorldCallbacks.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/b2Island.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/b2Fixture.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/b2ContactManager.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/b2World.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/b2Body.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Contacts/b2CircleContact.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Contacts/b2PolygonContact.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Contacts/b2Contact.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Contacts/b2ContactSolver.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Joints/b2GearJoint.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Joints/b2PulleyJoint.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Joints/b2FrictionJoint.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Joints/b2MouseJoint.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Joints/b2DistanceJoint.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Joints/b2RevoluteJoint.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Joints/b2MotorJoint.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Joints/b2PrismaticJoint.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Joints/b2WeldJoint.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Joints/b2Joint.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Joints/b2WheelJoint.o build/temp.linux-x86_64-3.5/Box2D/Dynamics/Joints/b2RopeJoint.o build/temp.linux-x86_64-3.5/Box2D/Common/b2StackAllocator.o build/temp.linux-x86_64-3.5/Box2D/Common/b2BlockAllocator.o build/temp.linux-x86_64-3.5/Box2D/Common/b2Timer.o build/temp.linux-x86_64-3.5/Box2D/Common/b2Math.o build/temp.linux-x86_64-3.5/Box2D/Common/b2Settings.o build/temp.linux-x86_64-3.5/Box2D/Common/b2Draw.o build/temp.linux-x86_64-3.5/Box2D/Collision/b2BroadPhase.o build/temp.linux-x86_64-3.5/Box2D/Collision/b2CollideCircle.o build/temp.linux-x86_64-3.5/Box2D/Collision/b2TimeOfImpact.o build/temp.linux-x86_64-3.5/Box2D/Collision/b2Collision.o build/temp.linux-x86_64-3.5/Box2D/Collision/b2CollidePolygon.o build/temp.linux-x86_64-3.5/Box2D/Collision/b2Distance.o build/temp.linux-x86_64-3.5/Box2D/Collision/b2DynamicTree.o build/temp.linux-x86_64-3.5/Box2D/Collision/b2CollideEdge.o build/temp.linux-x86_64-3.5/Box2D/Collision/Shapes/b2ChainShape.o build/temp.linux-x86_64-3.5/Box2D/Collision/Shapes/b2CircleShape.o build/temp.linux-x86_64-3.5/Box2D/Collision/Shapes/b2PolygonShape.o build/temp.linux-x86_64-3.5/Box2D/Collision/Shapes/b2EdgeShape.o -o build/lib.linux-x86_64-3.5/Box2D/_Box2D.cpython-35m-x86_64-linux-gnu.so
/home/aptx/anaconda3/envs/rl/compiler_compat/ld: cannot find -lm
/home/aptx/anaconda3/envs/rl/compiler_compat/ld: cannot find -lpthread
/home/aptx/anaconda3/envs/rl/compiler_compat/ld: cannot find -lc
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
----------------------------------------
Failed building wheel for box2d-py
为简洁起见,我省略了一些警告消息。我已经做了很多搜索,但仍然没有任何效果。我希望有人可以帮助我解决这个问题。预先感谢。
答案 0 :(得分:0)
好像您没有安装Anaconda编译器。 Anaconda的较新版本附带了自己的编译器。您可以参考this article来了解如何正确设置它。
如果已经安装了工具集,请确保activate
适当的环境,因为这还将设置必要的环境变量(在更新后停用/激活也可能会有所帮助)。