简体   繁体   中英

Opencv, Tkinter, Python 3, import imutils error on Mac

I have got a face recognition program working using python 2 and am attempting to develop a GUI interface to run it. I tried using tkinter under python 2 but unfortunately many of the widgets don't work or at least not very well, so I created a GUI with python 3, which looks reasonable. Unfortunately.

When I try to incorporate the Computer Vision program into the GUI it fails with the following:

 File "facePanel.py", line 24, in <module> import imutils File "/usr/local/lib/python3.7/site-packages/imutils/__init__.py", line 8, in <module> from.convenience import translate File "/usr/local/lib/python3.7/site-packages/imutils/convenience.py", line 6, in <module> import cv2 File "/usr/local/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module> bootstrap() File "/usr/local/lib/python3.7/site-packages/cv2/__init__.py", line 79, in bootstrap import cv2 ImportError: dlopen(/usr/local/lib/python3.7/site-packages/cv2/python-3.7/cv2.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/glog/lib/libglog.0.dylib Referenced from: /usr/local/Cellar/opencv/4.1.0_1/lib/libopencv_sfm.4.1.dylib Reason: image not found

So I tried installing imutils under python 3:

    $ sudo pip3 install imutils

Which tells me that the requirement is already satisfied:

Requirement already satisfied: imutils in /usr/local/lib/python3.7/site-packages (0.5.2)

I am new to OpenCV, Tkinter and Python so any pointers as to how to solve the issue would be greatly appreciated.

Thanks in advance

Problem fixed with the following:

~ $ brew install glog
~ $ python3
Python 3.7.3 (default, Mar 27 2019, 09:23:15)
[Clang 10.0.1 (clang-1001.0.46.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__'4.1.0'

From - https://github.com/Homebrew/homebrew-core/issues/39269

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM