我刚刚构建并安装了libfann和相关的 python 绑定。python 设置似乎运行正常:
$ sudo python setup.py install
Running SWIG before: swig -c++ -python pyfann/pyfann.i
running install
running build
running build_py
copying pyfann/libfann.py -> build/lib.macosx-10.5-x86_64-2.7/pyfann
running build_ext
building 'pyfann._libfann' extension
gcc -fno-strict-aliasing -I/Users/dwilliams/Desktop/Anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DSWIG_COMPILE -I../src/include -I/Users/dwilliams/Desktop/Anaconda/include/python2.7 -c pyfann/pyfann_wrap.cxx -o build/temp.macosx-10.5-x86_64-2.7/pyfann/pyfann_wrap.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
g++ -bundle -undefined dynamic_lookup -L/Users/dwilliams/Desktop/Anaconda/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/pyfann/pyfann_wrap.o ../src/doublefann.o -o build/lib.macosx-10.5-x86_64-2.7/pyfann/_libfann.so
running install_lib
creating /Users/dwilliams/Desktop/Anaconda/lib/python2.7/site-packages/pyfann
copying build/lib.macosx-10.5-x86_64-2.7/pyfann/__init__.py -> /Users/dwilliams/Desktop/Anaconda/lib/python2.7/site-packages/pyfann
copying build/lib.macosx-10.5-x86_64-2.7/pyfann/_libfann.so -> /Users/dwilliams/Desktop/Anaconda/lib/python2.7/site-packages/pyfann
copying build/lib.macosx-10.5-x86_64-2.7/pyfann/libfann.py -> /Users/dwilliams/Desktop/Anaconda/lib/python2.7/site-packages/pyfann
但随后导入失败:
$ python -c 'import pyfann'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "pyfann/__init__.py", line 4, in <module>
import libfann
File "pyfann/libfann.py", line 26, in <module>
_libfann = swig_import_helper()
File "pyfann/libfann.py", line 18, in swig_import_helper
import _libfann
ImportError: No module named _libfann
有谁知道如何解决这个问题?