3

我正在尝试使用命令编译 pyspatialite 2.6.1

sudo 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

如何修复此错误?

4

1 回答 1

5

我自己找到了答案。在 setup.py 中查找以下内容:

libraries = ['geos','geos_c','proj']

将“iconv”添加到该列表的末尾,使其看起来像这样:

libraries = ['geos','geos_c','proj','iconv']
于 2011-03-29T03:35:27.977 回答