opencv安装递归

时间:2019-11-18 08:00:34

标签: python opencv ubuntu

我正在使用Ubuntu(18.04.3LTS)和Anaconda for Python。 我正在尝试安装opencv,我遵循了安装教程。 但是当我键入:

    import opencv
    import cv2

我得到:

['/home/amyuval', '/home/amyuval/anaconda3/lib/python37.zip', '/home/amyuval/anaconda3/lib/python3.7', '/home/amyuval/anaconda3/lib/python3.7/lib-dynload', '', '/home/amyuval/anaconda3/lib/python3.7/site-packages', '/home/amyuval/anaconda3/lib/python3.7/site-packages/IPython/extensions', '/home/amyuval/.ipython']

ImportError Traceback (most recent call last)
<ipython-input-3-c8ec22b3e787> in <module>
     1 import cv2

~/anaconda3/lib/python3.7/cv2/__init__.py in <module>
     87     if DEBUG: print('OpenCV loader: DONE')
     88 
     89 bootstrap()

~/anaconda3/lib/python3.7/cv2/__init__.py in bootstrap()
     21     if hasattr(sys, 'OpenCV_LOADER'):
     22         print(sys.path)
     23         raise ImportError('ERROR: recursion is detected during loading of "cv2" binary extensions. Check OpenCV installation.')
     24     sys.OpenCV_LOADER = True
     25 

ImportError: ERROR: recursion is detected during loading of "cv2" binary extensions. Check OpenCV installation.

可能是什么问题?

1 个答案:

答案 0 :(得分:0)

在 Windows/MinGW 上,我也遇到了递归问题(但未链接到 OpenCV_LOADER)。
以下是诀窍(在 Python 主安装上,但不在 MSys2 上......):

pip3 install opencv-python --upgrade --force-reinstall # [--user]