Could not fetch URL https://pypi.org/simple/torchsummary/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/torchsummary/ (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 torchsummary (from versions: none)
ERROR: No matching distribution found for torchsummary
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.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("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
碰到这个问题,主要原因是网站pypi.python.org在国内是别墙了,在安装程序时,无法从python官网下载资料导致的。
下面解决方法适合windows系统
1.在C盘,进入%user%pip目录,就是在当前的用户找到pip文件夹,在里面创建pip.ini
文件,文件内容如下
[global]
index-url=http://pypi.douban.com/simple/
[install]
trusted-host=pypi.douban.com
2.保存,重新使用pip install xx即可
方法2:安装最新的openssl
打开网址:[ Downloads ] - /source/index.html
下载安装包:https://www.openssl.org/source/openssl-1.1.1d.tar.gz
编译安装:
tar -zxvf openssl-1.1.1d.tar.gz
cd openssl-1.1.1d
./config --prefix=/usr/local/openssl/
make && make install && make clean
mv /usr/bin/openssl /usr/bin/openssl.bak
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
方法三:
首先运行下面的代码:
pip config set global.extra-index-url http://mirrors.aliyun.com/pypi/simple
2. 找到上面路径下的文件,使用以下内容覆盖原本pip.ini中的内容文章来源:https://www.toymoban.com/news/detail-845809.html
[global]
index-url = https://mirrors.aliyun.com/pypi/simple
extra-index-url = https://mirrors.aliyun.com/pypi/simple
[install]
trusted-host =
mirrors.aliyun.com
pypi.douban.com
pypi.tuna.tsinghua.edu.cn
pypi.mirrors.ustc.edu.cn
mirrors.ustc.edu.cn
mirrors.bfsu.edu.cn
pypi.hustunique.com
文章来源地址https://www.toymoban.com/news/detail-845809.html
到了这里,关于pip安装出现SSL问题三种解决方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!