我正在开发一个调用 python 脚本的 C 共享库。当我运行应用程序时,我收到此错误:
Traceback (most recent call last):
File "/home/ubuntu/galaxy-es/lib/galaxy/earthsystem/gridftp_security/gridftp_acl_plugin.py", line 2, in <module>
import galaxy.eggs
File "/home/ubuntu/galaxy-es/lib/galaxy/eggs/__init__.py", line 5, in <module>
import os, sys, shutil, glob, urllib, urllib2, ConfigParser, HTMLParser, zipimport, zipfile
File "/usr/lib/python2.7/zipfile.py", line 6, in <module>
import io
File "/usr/lib/python2.7/io.py", line 60, in <module>
import _io
ImportError: /usr/lib/python2.7/lib-dynload/_io.so: undefined symbol: PyExc_ImportError
如果我尝试从控制台导入模块 io 可以正常工作:
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import galaxy.eggs
>>>
在编译库期间,我使用了这里建议的编译器选项: Embedding python in C, undefined symbol: PyExc_ImportError 此外,我还添加了从 python-config --includes|--libs|-- 获得的编译器选项cflags|--ldflags
在这里您可以找到库http://pastebin.com/348rhBjM的 makefile 的日志
非常感谢,任何帮助将不胜感激。