问题
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):
- Place the .so in /usr/local/lib.
- Place the .so in /usr/lib. This is probably a bad idea.
- 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