Boost.Python tutorial in Ubuntu 10.04

自古美人都是妖i 提交于 2019-12-11 02:03:28

问题


I downloaded the latest version of Boost and I'm trying to get the Boost.python tutorial up and running on Ubuntu 10.04: http://www.boost.org/doc/libs/1_43_0/libs/python/doc/tutorial/doc/html/python/hello.html

I navigated to the correct directory, ran "bjam" and it compiled using default settings. I did not yet create a bjam config file. The compilation appears to have worked, but now I have no idea how to include the files in my python script. When I try to run the python hello world script, it gives me this error:

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

Anyone know what is going on?


回答1:


How did you install boost ? Assuming you have use the following: http://www.boost.org/doc/libs/1_43_0/more/getting_started/unix-variants.html#easy-build-and-install

liboost_python shard library will be install in /usr/local/lib

To run the hello.py example, try the following:

LD_LIBRARY_PATH=/usr/local/lib python ./hello.py



回答2:


I have no experience with the the Boost Python libraries but as the error states, it is unable to find the libboost_python shared object.

You have several options here (there may be more):

  1. Place the .so in /usr/local/lib.
  2. Place the .so in /usr/lib. This is probably a bad idea.
  3. Run export LD_LIBRARY_PATH=/path_to_so/ before execution.



回答3:


Did you install boost? Just compiling it isn't sufficient to install the libraries where they need to be to run programs.



来源:https://stackoverflow.com/questions/3009533/boost-python-tutorial-in-ubuntu-10-04

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!