Windows下python安装opencv

522 阅读1分钟

安装

首先安装python、pip、numpy

进入www.lfd.uci.edu/~gohlke/pyt… ,根据之前python的版本决定下载whl格式文件,下载后进入文件所在位置,命令行输入pip install *.whl

复制下载的Opencv 3.2模块到Python的安装目录Python\Python35\Lib\site-packages下,cmd下运行 : pip install opencv_python-3.2.0-cp35-cp35m-win_amd64.whl

pip install xxx 解决办法

错误详情

Could not fetch URL pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:852)'),)) - skipping

解决办法

进入cmd创建pip文件夹

C:\User\Administrator>md pip

在该文件夹下创建pip.ini(创建.txt,然后修改后缀),写入以下内容

[global]

index-url=http://mirrors.aliyun.com/pypi.simple/

[install]

trusted-host=mirrors.aliyun.com

最后配置环境变量:%HOMEPATH%\pip\pip.ini

接着再使用pip install xxx

成功。