正在与boost::python作斗争
Struggling with boost::python
我正在尝试运行helloworld-boost-python示例,乍一看一切似乎都很好。我得到以下输出
>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
您需要配置您的环境来查找boost库。这与python没有太大关系,但与boost安装有关。最快的方法是扩展LD_LIBRARY_PATH环境变量。
看看这里:
加载boost 的共享库时出错
相关文章:
- 如何运行位于boost/libs/python/example/tutorial目录中的hello.cpp和Jamfil
- Pybind11:将元组列表从Python传递到C++
- 如何在c++中使用引用实现类似python的行为
- 是否可以通过C++扩展强制多个python进程共享同一内存
- 递归列出所有目录中的C++与Python与Ruby的性能
- IPC使用多个管道和分支进程来运行Python程序
- 从python中调用C++函数并获取返回值
- Python 3.7 和 excess_args 的 SWIG 问题
- Python中的for循环与C++有何不同
- 在C++游戏中与库存系统作斗争
- 使用Pybind11向Python公开Eigen::张量
- Python str to C++ to Python str
- 如何使用Python从C++中读取谷物序列化数据
- 如何在C++中使用pybind11加载一个pickle python列表
- 如何在c++中使用system()来运行包含空格的python脚本
- python集合的C++等价物是什么.计数器
- 如果C++对象的类在另一个boost模块中声明,如何使用boost将指向该对象的指针返回到python
- 从python调用openMP共享库时,未定义opnMP函数
- 使用JsonCpp将数据返回到带有pybind11的python会在python调用中产生Symbol not foun
- 正在与boost::python作斗争