gpt4 book ai didi

python - 导入 dlib 导入错误符号未找到 : _PyClass_Type

转载 作者:行者123 更新时间:2023-11-28 17:13:19 24 4
gpt4 key购买 nike

当我在 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

我尝试卸载 boost-python 然后 brew install boost-python --with-python3 没有结果。

这也是 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)

我对链接错误的感觉不是很强烈,任何想法都将不胜感激。

最佳答案

检查文件夹/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

创建一个文件夹备份这些文件,然后将编号为3的文件复制到没有编号3的文件。例如,将libboost_python3-mt.dylib复制到libboost_python-mt.dylib,那么它将起作用。

关于python - 导入 dlib 导入错误符号未找到 : _PyClass_Type,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45923202/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com