系统环境
- windows
- anaconda
- pip清华源
错误描述
通过pip install 安装不成功,会报错(Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
错误详情如下:
ghua.edu.cn', port=443): Max retries exceeded with url: /simple/opencv-python/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")
) - skipping
ERROR: Could not find a version that satisfies the requirement opencv-python (from versions: none)
ERROR: No matching distribution found for opencv-python
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.c
.cn', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping ERROR: Could not find a version that satisfies the requirement opencv-python (from versions: none)
ERROR: No matching distribution found for opencv-python
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.c
n', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
WARNING: There was an error checking the latest version of pip.
具体是什么错误什么原因导致,不去深究了。或许是源本身有问题?下面直接提供解决方法,通过更换源解决了该错误
解决方法
临时源测试
pip install opencv-python -i http://pypi.douban.com/simple
# 依然会报以下错误,提示 is not a trusted
Looking in indexes: http://pypi.douban.com/simple
WARNING: The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use H
TTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.douban.com'.
ERROR: Could not find a version that satisfies the requirement opencv-python (from versions: none)
ERROR: No matching distribution found for opencv-python
WARNING: The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use H
TTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.douban.com'.
WARNING: There was an error checking the latest version of pip.
加上--trusted-host,命令如下不会报错了
文章来源:https://www.toymoban.com/news/detail-608173.html
pip install opencv-python -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
windows命令行更换源(永久)
有很多人是用手动方式,在C:\Users\Administrator\AppData\Roaming下,创建一个pip文件夹,编辑pip.ini文件
这里采用命令操作,win+R然后cmd的命令行换源,输入以下两行指令即可
文章来源地址https://www.toymoban.com/news/detail-608173.html
# 以阿里云为例
pip config set global.index-url http://mirrors.aliyun.com/simple
pip config set global.trusted-host mirrors.aliyun.com
# 还有其他很多源,比如以下:
# http://mirrors.aliyun.com/pypi/simple 阿里云
# http://pypi.douban.com/simple 豆瓣
# https://pypi.tuna.tsinghua.edu.cn/simple 清华大学
# http://pypi.mirrors.ustc.edu.cn/simple 中国科学技术大学
到了这里,关于windows: pip install 报错SSLError Can‘t connect to HTTPS URL because the SSL module is not available的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!