系統(tǒng)環(huán)境
- 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.
具體是什么錯誤什么原因?qū)е?,不去深究了?;蛟S是源本身有問題?下面直接提供解決方法,通過更換源解決了該錯誤
解決方法
臨時源測試
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,命令如下不會報錯了
文章來源:http://www.zghlxwxcb.cn/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下,創(chuàng)建一個pip文件夾,編輯pip.ini文件
這里采用命令操作,win+R然后cmd的命令行換源,輸入以下兩行指令即可
文章來源地址http://www.zghlxwxcb.cn/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 中國科學技術(shù)大學
到了這里,關(guān)于windows: pip install 報錯SSLError Can‘t connect to HTTPS URL because the SSL module is not available的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!