我正在尝试使用命令
编译pyspatialite 2.6.1sudo python setup.py install
它成功编译但生成的二进制文件缺少符号。当我从中导入dbapi2模块时,我收到以下错误。
Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyspatialite import dbapi2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyspatialite/dbapi2.py", line 27, in <module>
from pyspatialite._spatialite import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyspatialite/_spatialite.so, 2): Symbol not found: _iconv
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyspatialite/_spatialite.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyspatialite/_spatialite.so
如何解决此错误?
答案 0 :(得分:5)
我自己找到了答案。在setup.py中查找一行:
libraries = ['geos','geos_c','proj']
将'iconv'添加到该列表的末尾,使其如下所示:
libraries = ['geos','geos_c','proj','iconv']