简体   繁体   English

3、Mac 上导入 imutils 错误

[英]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.我有一个使用 python 2 工作的人脸识别程序,并且正在尝试开发一个 GUI 界面来运行它。 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.我尝试在 python 2 下使用 tkinter 但不幸的是,许多小部件无法正常工作或至少不是很好,所以我使用 python 3 创建了一个 GUI,这看起来很合理。 Unfortunately.很遗憾。

When I try to incorporate the Computer Vision program into the GUI it fails with the following:当我尝试将计算机视觉程序合并到 GUI 中时,它会失败并显示以下内容:

 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:所以我尝试在 python 3 下安装 imutils:

    $ 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)已满足要求:/usr/local/lib/python3.7/site-packages (0.5.2) 中的 imutils

I am new to OpenCV, Tkinter and Python so any pointers as to how to solve the issue would be greatly appreciated.我是 OpenCV、Tkinter 和 Python 的新手,因此将不胜感激任何有关如何解决该问题的指针。

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从 - https://github.com/Homebrew/homebrew-core/issues/39269

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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