OpenCV和CV2安装错误

OpenCV和CV2安装错误

本文介绍了Pycharm/Python OpenCV和CV2安装错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试按照以下建议从Pycharm和终端安装OpenCV和cv2:

I've been trying to install both OpenCV and cv2 from both Pycharm and from the terminal as suggested using:

pip install --user opencv
pip install --user cv2

但是我遇到了以下错误:

but I'm getting the following error for them:

Collecting opencv
  Could not find a version that satisfies the requirement opencv (from versions: )
No matching distribution found for opencv

Collecting cv2
  Could not find a version that satisfies the requirement cv2 (from versions: )
No matching distribution found for cv2

如何解决这些问题并正确安装软件包?我正在使用python 3.4.

How can I fix these and install the packages properly? I'm using python 3.4.

推荐答案

由于opencvcv2不是python软件包名称,因此您会收到这些错误.

You are getting those errors because opencv and cv2 are not the python package names.

这些都包含在opencv-python软件包中,可从pip安装.

These are both included as part of the opencv-python package available to install from pip.

如果您使用的是python 2,则可以使用pip进行安装:

If you are using python 2 you can install with pip:

 pip install opencv-python

或者对python 3使用等效项:

Or use the equivilent for python 3:

pip3 install opencv-python

运行适当的pip命令后,您的软件包应可从python使用.

After running the appropriate pip command your package should be available to use from python.

这篇关于Pycharm/Python OpenCV和CV2安装错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 21:20