使用conda 4.3.21为python 3.6安装pybox2d [英] Install pybox2d for python 3.6 with conda 4.3.21
问题描述
为了运行此代码,我需要安装Box2d,这是我出现问题的地方. 我正在使用conda 4.3.21和python 3.6的ubuntu 16.04. 当我尝试运行环境时,收到错误消息:ModuleNotFoundError:没有名为"_Box2D"的模块
所以我尝试直接安装pybox2d: https://github.com/pybox2d/pybox2d/blob/master/INSTALL.md 产生相同的错误信息.
然后,我尝试按照 https://github.com/中概述的方法从GitHub安装cbfinn/gps/issues/34
$git clone https://github.com/pybox2d/pybox2d pybox2d_dev
$cd pybox2d_dev
$python setup.py build
$sudo python setup.py install
如果我运行此命令(在具有python 3的根环境或使用python 3另一个新创建的环境中),则会得到结果:
大量处理日志 处理Box2D-2.3.2-py2.7-linux-x86_64.egg 创建/usr/local/lib/python2.7/dist-packages/Box2D-2.3.2-py2.7-linux-x86_64.egg 将Box2D-2.3.2-py2.7-linux-x86_64.egg提取到/usr/local/lib/python2.7/dist-packages 将Box2D 2.3.2添加到easy-install.pth文件
已安装/usr/local/lib/python2.7/dist-packages/Box2D-2.3.2-py2.7-linux-x86_64.egg Box2D的处理依赖关系== 2.3.2 Box2D == 2.3.2
的已完成处理依赖性因此,尽管pybox2d处于python 3 conda环境中,但仍将其安装到ubuntu的标准python 2的lib中.
所以,我正在寻找使用conda 4.3.21为python 3安装pybox2d软件包的方法
从pip
安装Box2D
导致我遇到了https://github.com/pybox2d/pybox2d/blob/master/INSTALL.md
which yielded the same error message.
Then I tried to install from GitHub following the way outlined in https://github.com/cbfinn/gps/issues/34
$git clone https://github.com/pybox2d/pybox2d pybox2d_dev
$cd pybox2d_dev
$python setup.py build
$sudo python setup.py install
If I run this (in root environment which has python 3 or another new created environment with python 3) i get the result:
a lot of processing logs Processing Box2D-2.3.2-py2.7-linux-x86_64.egg creating /usr/local/lib/python2.7/dist-packages/Box2D-2.3.2-py2.7-linux-x86_64.egg Extracting Box2D-2.3.2-py2.7-linux-x86_64.egg to /usr/local/lib/python2.7/dist-packages Adding Box2D 2.3.2 to easy-install.pth file
Installed /usr/local/lib/python2.7/dist-packages/Box2D-2.3.2-py2.7-linux-x86_64.egg Processing dependencies for Box2D==2.3.2 Finished processing dependencies for Box2D==2.3.2
So pybox2d is installed into the lib of the standard python 2 of ubuntu despite being in a python 3 conda environment.
So, I am looking for ways to install the pybox2d package for python 3 with conda 4.3.21
Installing Box2D
from pip
led me to the error described here when I tried to import it. Here's what worked for me on Python 3.6, as suggested in that GitHub issue:
conda install swig # needed to build Box2D in the pip install
pip install box2d-py # a repackaged version of pybox2d
这篇关于使用conda 4.3.21为python 3.6安装pybox2d的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!