【问题标题】:Struggling with boost::python与 boost::python 斗争
【发布时间】:2013-06-30 07:39:02
【问题描述】:

我正在尝试运行 hello world boost python example 乍一看一切都很好。我得到以下输出

>bjam
...patience...
...patience...
...found 1727 targets...
...updating 9 targets...
gcc.compile.c++ bin/gcc-4.7/debug/hello.o
gcc.link.dll bin/gcc-4.7/debug/hello_ext.so
common.copy libboost_python.so.1.53.0
ln-UNIX libboost_python.so
ln-UNIX libboost_python.so.1
ln-UNIX libboost_python.so.1.53
common.copy hello_ext.so
capture-output bin/hello.test/gcc-4.7/debug/hello
**passed** bin/hello.test/gcc-4.7/debug/hello.test
...updated 9 targets...

但是,当我尝试在 python 中使用它时,我收到一条导入错误消息

>python
Python 2.7.4 (default, Apr 19 2013, 18:32:33) 
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import hello
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "hello.py", line 6, in <module>
  import hello_ext
ImportError: libboost_python.so.1.53.0: cannot open shared object file: No such file or directory

【问题讨论】:

    标签: c++ python boost


    【解决方案1】:

    您需要配置您的环境才能找到 boost 库。这与python没有太大关系,但与boost安装有关。最快的方法是扩展 LD_LIBRARY_PATH 环境变量。

    看看这里:

    Error loading shared libraries of boost

    【讨论】:

      猜你喜欢
      • 2014-10-04
      • 1970-01-01
      • 2020-09-18
      • 2018-05-23
      • 2013-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多