Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python3 openCV install error: Symbol not found: _clock_gettime

Can anyone help me fixing an error when importing opencv in python3?

when I import cv2 in python3, I get something like

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

Also, I'm using python version 3.6.3

like image 270
seungchan kim Avatar asked Feb 10 '18 05:02

seungchan kim


2 Answers

If you don't want to upgrade your OS, you can install an earlier version of opencv:

pip install opencv-python==3.3.0.10

like image 60
S.S. Avatar answered Nov 20 '22 04:11

S.S.


clock_gettime() was added in macOS 10.12. It says so in the error message.

From what I understand it may be possible to build against an earlier Xcode SDK, but the easiest is probably to upgrade to Mac's latest OS.

like image 41
redolent Avatar answered Nov 20 '22 03:11

redolent