简体   繁体   中英

Boost.Python tutorial in Ubuntu 10.04

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?

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM