[英]import dlib ImportError Symbol not found: _PyClass_Type
When I run import dlib
in Python 3.6 I get the following error: 当我在Python 3.6中运行import dlib
,我收到以下错误:
Traceback (most recent call last):
File "demo.py", line 3, in <module>
import dlib
File "/usr/local/lib/python3.6/site-packages/dlib/__init__.py", line 1, in <module>
from .dlib import *
ImportError: dlopen(/usr/local/lib/python3.6/site-packages/dlib/dlib.so, 2): Symbol not found: _PyClass_Type
Referenced from: /usr/local/opt/boost-python/lib/libboost_python-mt.dylib
Expected in: flat namespace in /usr/local/opt/boost-python/lib/libboost_python-mt.dylib
I tried unistalling boost-python
and then brew install boost-python --with-python3
with no result. 我试着unistalling boost-python
然后brew install boost-python --with-python3
没有结果。
Here is also the output of otool -L /usr/local/lib/libboost_python.dylib
: 这里也是otool -L /usr/local/lib/libboost_python.dylib
的输出:
/usr/local/lib/libboost_python.dylib:
/usr/local/opt/boost-python/lib/libboost_python.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.5.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.50.2)
I am not feeling very strong in terms of linking errors, any ideas would be appreciated. 我在链接错误方面感觉不是很强烈,任何想法都会受到赞赏。
Check folder /usr/local/opt/boost-python/lib/
, there are these files: 检查文件夹/usr/local/opt/boost-python/lib/
,有以下文件:
/u/l/l/p/site-packages> cd /usr/local/opt/boost-python/lib/
/u/l/C/b/1/lib> ls
libboost_numpy-mt.a libboost_numpy3-mt.a libboost_python-mt.a libboost_python3-mt.a
libboost_numpy-mt.dylib libboost_numpy3-mt.dylib libboost_python-mt.dylib libboost_python3-mt.dylib
libboost_numpy.a libboost_numpy3.a libboost_python.a libboost_python3.a
libboost_numpy.dylib libboost_numpy3.dylib libboost_python.dylib libboost_python3.dylib
Create a folder backup these files, then copy files with number 3 to files without number 3. For example, copy libboost_python3-mt.dylib
to libboost_python-mt.dylib
, then it will work. 创建一个备份这些文件的文件夹,然后将编号为3的文件复制到没有编号3的文件。例如,将libboost_python3-mt.dylib
复制到libboost_python-mt.dylib
,然后它就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.