2013-05-09 87 views
0

这是一篇关于在python3中安装模块的文章。当我使用brew安装python时,它安装它为2.7。无法使用mapnik工作与python3,但它与python2

当我使用丹,其目的是直接在python3(谁我真的很感谢)安装建议的方法,但没有奏效:

# Figure out the path to python3 
PY3DIR=`dirname $(which python3)` 
# And /then/ install with brew. That will have it use python3 to get its path 
PATH=$PY3DIR:$PATH brew install mapnik 

安装成功在python2。所以我得到:

For non-homebrew Python, you need to amend your PYTHONPATH like so: export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH 

,所以我最后加在python3手动路径

import sys 
sys.path.append('/usr/local/lib/python2.7/site-packages') 

我得到这个错误:

Traceback (most recent call last): File "<stdin>", line 1, in <module> 
File "/usr/local/lib/python2.7/site-packages/mapnik/__init__.py", line 69, in <module> 
    from _mapnik import * ImportError: dlopen(./_mapnik.so, 2): Symbol not found: _PyClass_Type Referenced from: ./_mapnik.so 
Expected in: flat namespace in ./_mapnik.so 

请帮帮忙,我花了这么多小时...

谢谢!

回答

1

Mapnik python绑定依赖于boost_python。并且都需要使用相同的python。问题可能是自制软件提供了一瓶升压,其中包括针对python 2.7而不是python 3.x构建的boost python。

+0

回到python 2 – Gabriel 2013-05-09 20:25:30

相关问题