Pycharm/Python OpenCV 和 CV2 安装错误

Pycharm/Python OpenCV and CV2 install error(Pycharm/Python 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

但我收到以下错误:

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.

推荐答案

您收到这些错误是因为 opencv 和 cv2 不是 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 安装错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Pycharm/Python OpenCV 和 CV2 安装错误

基础教程推荐