问题:
从虚拟环境内部无法导入dlib
,其引用引用dlib.so
的{{1}}:
libboost_python.so
环境:
从来源编译(venv) serj@venus ~/work/beautytorch $ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/serj/work/beautytorch/venv/local/lib/python2.7/site-packages/dlib/__init__.py", line 1, in <module>
from .dlib import *
ImportError: libboost_python.so.1.64.0: cannot open shared object file: No such file or directory
>>>
:
Boost.Python
将链接放到我的虚拟环境中(最后两个,不知道哪个是正确的):
serj@venus ~ $ ls -l /usr/local/lib | grep boost
-rw-r--r-- 1 root root 670876 Jun 16 14:10 libboost_python.a
lrwxrwxrwx 1 root root 25 Jun 16 14:10 libboost_python.so -> libboost_python.so.1.64.0
-rwxr-xr-x 1 root root 408147 Jun 16 14:10 libboost_python.so.1.64.0
现在尝试导入serj@venus ~/work/beautytorch/venv/lib/python2.7/site-packages $ ls -l | grep boost
drwxr-xr-x 2 serj serj 4096 Jun 16 13:40 boost
drwxr-xr-x 2 serj serj 4096 Jun 16 13:40 boost-0.1.dist-info
lrwxrwxrwx 1 serj serj 40 Jun 19 11:50 libboost_python.so -> /usr/local/lib/libboost_python.so.1.64.0
lrwxrwxrwx 1 serj serj 40 Jun 19 12:13 libboost_python.so.1.64.0 -> /usr/local/lib/libboost_python.so.1.64.0
,导入与dlib
dlib.so
libboost_python.so.1.64.0
请参阅dlib.so包含对确切的serj@venus ~/work/beautytorch/venv/lib/python2.7/site-packages/dlib $ ls -l
total 14324
-rw-r--r-- 1 serj serj 14631694 Jun 16 14:16 dlib.so
drwxr-xr-x 2 serj serj 4096 Jun 16 14:16 examples
-rw-r--r-- 1 serj serj 43 Jun 16 14:16 __init__.py
-rw-r--r-- 1 serj serj 200 Jun 16 14:16 __init__.pyc
serj@venus ~/work/beautytorch/venv/lib/python2.7/site-packages/dlib $ cat __init__.py
from .dlib import *
库版本的引用:
UPD strace输出:
libboost_python