简体   繁体   English

导入 cv2 丢失 - python3.7

[英]Import cv2 missing - python3.7

I am trying to import cv2 from the python modules in site packages.我正在尝试从站点包中的 python 模块导入 cv2。

I've seen other solutions where you add the module into the site packages directory for python, did pip install and was notified that it installed correctly.我已经看到其他解决方案,您将模块添加到 python 的站点包目录中,执行 pip install 并被通知它安装正确。 I also did a reinstall of the module and its opencv-contrib-python.我还重新安装了该模块及其 opencv-contrib-python。

When installing opencv-python and attempting to import cv2, I also recieved an error message that there was recursions in the ini file for open cv.在安装 opencv-python 并尝试导入 cv2 时,我还收到一条错误消息,指出 opencv 的 ini 文件中存在递归。

如果你使用的是 python3,你需要做

pip3 install opencv-contrib-python

How do you install opencv?你如何安装opencv? do you try this code?你试试这个代码?

pip install opencv-python

try it and open a new python file and type this code on it.尝试并打开一个新的python文件并在其上键入此代码。

import cv2
print(cv2.__version__)

check this answer and report result.检查此答案并报告结果。 good luck!祝你好运!

hi sir try doing this:嗨,先生,请尝试这样做:

pip install opencv-python pip 安装 opencv-python

instead of this:而不是这个:

pip install opencv-contrib-python pip 安装 opencv-contrib-python

hope this helps :)) i also had a problem installing it but fixed it easily.希望这会有所帮助:)) 我在安装它时也遇到了问题,但很容易修复。 if you have any problems, feel free to ask more如果您有任何问题,请随时询问更多

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

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