2
在雪豹(OS X 10.6.8)上,我無法加載使用boost python構建的擴展模塊。該代碼是:在mac上雪豹豹Macports的助推python導入錯誤
#include <boost/python.hpp>
char const* greet()
{
return "hello, world";
}
BOOST_PYTHON_MODULE(func_ext)
{
using namespace boost::python;
def("greet", greet);
}
我建立:
/usr/bin/g++ -o src/func_ext.os -c -fPIC -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/opt/local/include src/func_ext.cpp
/usr/bin/g++ -o func_ext.dylib -dynamiclib src/func_ext.os -L/opt/local/lib -lpython2.7 -lboost_python-mt
的錯誤是:
15:52:[email protected]=>LD_LIBRARY_PATH=`pwd` python
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import func_ext
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named func_ext
任何人都可以請幫助? 非常感謝您提前!