python3 openCV安装错误:找不到符号:_clock_gettime

时间:2018-02-10 05:52:48

标签: python python-3.x opencv

在python3中导入opencv时,有人可以帮我解决错误吗?

当我在python3中导入cv2时,我得到类似

的东西
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/cv2/__init__.py", line 4, in <module>
from .cv2 import *

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cv2/cv2.cpython-36m-darwin.so, 2): 
Symbol not found: _clock_gettime
Referenced from: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cv2/.dylibs/libavutil.55.78.100.dylib 
(which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cv2/.dylibs/libavutil.55.78.100.dylib

另外,我使用的是python版本3.6.3

2 个答案:

答案 0 :(得分:2)

如果您不想升级您的操作系统,可以安装早期版本的opencv:

pip install opencv-python==3.3.0.10

答案 1 :(得分:1)

在macOS 10.12中添加了

clock_gettime()。它在错误消息中这样说。

根据我的理解,可能可以针对早期的Xcode SDK构建,但最简单的可能是升级到Mac的最新操作系统。