2013-06-30 3 views
1

J'essaie de lancer le hello world boost python example et à première vue tout semble bien. Je reçois la sortie suivanteLuttant avec 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... 

Cependant, lorsque je tente de l'utiliser en python, je reçois un message d'erreur d'importation

>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 

Répondre

1

Vous devez configurer votre environnement pour trouver les bibliothèques Boost. Cela n'a pas grand chose à voir avec python, mais avec l'installation boost. Le moyen le plus rapide est d'étendre la variable d'environnement LD_LIBRARY_PATH.

Jetez un oeil ici:

Error loading shared libraries of boost