简体   繁体   English

如何将 OpenCV 导入 python

[英]How to import OpenCV into python

I have downloaded Anaconda on my Windows PC, and I have been using Spyder IDE.我已经在我的 Windows PC 上下载了 Anaconda,并且我一直在使用 Spyder IDE。 Now I want to do a project with OpenCV.现在我想用 OpenCV 做一个项目。

However, I have tried to install OpenCV using the Command Prompt and typing the following in:但是,我尝试使用命令提示符安装 OpenCV 并输入以下内容:

pip install opencv-python 

This only gives an error message and says "pip" is not recognized as a command.这只会给出一条错误消息,并说“pip”不被识别为命令。

Furthermore I tried to import OpenCV into Python using the following:此外,我尝试使用以下命令将 OpenCV 导入 Python :

import cv2

This also doesn't work这也行不通

I would appreciate any help in getting OpenCV working.对于让 OpenCV 工作的任何帮助,我将不胜感激。

It depends on Your OS.这取决于您的操作系统。 Check Your pip installation with cmd: pip -V and check python with: python -V It seems like You don't have pip installed at all. Check Your pip installation with cmd: pip -V and check python with: python -V It seems like You don't have pip installed at all. Than import cv2 should work.比 import cv2 应该工作。

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

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