在opencv安装后在Python中导入cv2时出错

伊恩·穆库尼亚·道格拉斯

我已经成功安装了OpenCV,但是当我尝试将其导入Python时,出现以下错误。

在Python 2.7中,我得到了

[imukunya@li165-244 site-packages]$ python

Python 2.7.5 (default, Oct 30 2018, 23:45:53)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> import cv2
>>> ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: numpy.core.multiarray failed to import

在Python 3.6中,出现此错误

[imukunya@li165-244 site-packages]$ python3.6

Python 3.6.5 (default, Apr 10 2018, 17:08:37)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> import cv2

>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define module export function (PyInit_cv2)

我已经尝试使用安装NumPy $~python3 -m pip install numpy -I

Rahila T-英特尔

请尝试执行以下命令。然后,请验证您的代码是否有效。

python -m pip安装opencv-contrib-python

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在Azure函数中导入python cv2时出错

在python3,anaconda中导入cv2时出错

尝试导入cv2(opencv-python)软件包时出错

在 Spyder 中导入 cv2 时出现导入错误(Python 3.6)

Python/OS X:从源代码安装 OpenCV,但导入 cv2 导致导入错误

无法在OSX中的python中导入cv2

如何安装没有导入cv2错误的openCV_python?

Windows:已安装 OpenCV 但在 Python 中出现“无法导入 cv2”错误

尽管安装了 OpenCV-python,但导入 cv2 不起作用

使用brew的macOS python3,导入cv2时出错

导入cv2(opencv)时出现“ DLL加载失败”

Anaconda:即使已安装opencv,也无法导入cv2(如何为python3安装opencv3)

导入opencv vs导入cv2

CV2:Python OpenCV 中的导入错误

aws eb opencv-python“网络:从 .cv2 导入”

在nodejs pyshell中导入已安装的python包时出错

导入cv2时出现python importError

无法在python中导入打开的cv2。错误:无法编译“ Python.h”。也许您需要安装python-dev | python-devel [[无法升级numpy]]

如何在python 3.5 64bit中导入cv2?

如何在python3中导入cv2?

无法在64位版本的python 3.6.5中导入cv2

如何在slurm中导入cv2?

发出在Jetson Nano上安装OpenCV 4.1.2的问题。导入cv2,没有名为“ cv2”的模块

如何为 python 安装 cv2?

使用Python 3的opencv 3.0.0 alpha无法导入cv2

在Python中导入Facebook模块时出错

在Python中导入LinkedIn API时出错

在Python中导入Statsmodels时出错

设置CV2窗口的全屏属性时出错