ImportError:终端中运行.py文件时没有名为cv2的模块错误

时间:2018-01-03 10:58:32

标签: python macos opencv

我在运行包含import opencv命令的python脚本文件时遇到问题。运行该文件时,它会出现以下错误: ImportError: No module named cv2

然后我运行了pip install python-opencv,但却出现Could not find a version that satisfies the requirement python-opencv (from versions: ) No matching distribution found for python-opencv错误。

有谁知道问题可能是什么?我最初能够运行这个python文件,但之后我还没能运行。

2 个答案:

答案 0 :(得分:1)

包名称错误pip install opencv-python应该有效。

答案 1 :(得分:0)

我也遇到过这个问题。尝试过不同的事情。但最后

conda install opencv

为我解决了这个问题。