2

我下载了最新版本的 Boost,我正在尝试在 Ubuntu 10.04 上启动并运行 Boost.python 教程:http: //www.boost.org/doc/libs/1_43_0/libs/python/doc/tutorial/ doc/html/python/hello.html

我导航到正确的目录,运行“bjam”并使用默认设置编译。我还没有创建 bjam 配置文件。编译似乎已经奏效,但现在我不知道如何在我的 python 脚本中包含这些文件。当我尝试运行 python hello world 脚本时,它给了我这个错误:

Traceback (most recent call last):
  File "./hello.py", line 6, in <module>
    import hello_ext
ImportError: libboost_python.so.1.43.0: cannot open shared object file: No such file or  directory

有谁知道发生了什么?

4

3 回答 3

5

你是如何安装 boost 的?假设您使用以下内容:http: //www.boost.org/doc/libs/1_43_0/more/getting_started/unix-variants.html#easy-build-and-install

liboost_python 分片库将安装在 /usr/local/lib

要运行 hello.py 示例,请尝试以下操作:

LD_LIBRARY_PATH=/usr/local/lib python ./hello.py
于 2010-06-09T21:08:50.243 回答
2

我没有使用 Boost Python 库的经验,但由于错误状态,它无法找到 libboost_python 共享对象。

您在这里有几个选择(可能还有更多):

  1. 将 .so 放在 /usr/local/lib 中。
  2. 将 .so 放在 /usr/lib 中。这可能是个坏主意。
  3. 在执行前运行export LD_LIBRARY_PATH=/path_to_so/
于 2010-06-09T20:32:54.027 回答
0

你安装了boost吗?仅仅编译它还不足以将库安装在运行程序所需的位置。

于 2010-06-09T20:28:26.877 回答