python 下 安装openCV

安装openCV

openCV是Intel 创建的计算机视觉库,用于计算机图像处理。
安装anaconda,在命令行中输入conda install cv2/opencv

报错汇总

网络连接问题

报错描述:

在输入下载安装命令后出现网络连接问题

C:Usersning0>conda install numpy
Fetching package metadata ...
CondaHTTPError: HTTP None None for url https://repo.continuum.io/pkg...
Elapsed: None
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
ProxyError(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/free/win-64/repodata.json.bz2 (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x00000000048F3048>: Failed to establish a new connection: [Errno 10061] ',)))",),)

解决方法:

    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    conda config --set show_channel_urls yes    

输入以上指令再下载,若还不能解决问题,查看博客

报错描述:

在python中import cv2 报错:Error import cv2 : ImportError: numpy.core.multiarray failed to import

解决方法:

错误原因是因为numpy的版本太旧,更新新版本的numpy可解决此问题
    pip install -U numpy

或者

    conda update numpy
注:对于装有多个python 的电脑,要分清编译器使用的python位置和命令行中的python,是否是同一个,使用
    numpy.version.version
    numpy.__file__

查看numpy的版本和位置,在libsite-packeges,将新的numpy文件覆盖掉旧的numpy文件

原文地址:https://www.cnblogs.com/qiwenzhou/p/7608277.html