There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.org‘,port=443)
最新推荐文章于 2023-04-25 01:43:14 发布
ciky奇
最新推荐文章于 2023-04-25 01:43:14 发布
21942
在配置好anaconda环境后(如遇到conda指令无法安装库或者安装较慢问题参见文末),想用pip install安装相应的包(我这边的示例安装yacs这个库),发现出现如下的错误:
Could not fetch URL https://pypi.org/simple/yacs/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/yacs/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))) - skipping
类似是你的电脑在打开pypi.org这个网站的时候提示有安全问题,报了证书相关的错误。
解决方法
是你将该网站指定为可信任就行了~
pip install --trusted-host pypi.org 安装的包名字.whl
如果这之后还出现如下问题:
ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='
files.pythonhosted.org
', port=443): Max retries exceeded with url: /packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)')))
那么再把
files.pythonhosted.org
设置成受信任就OK了。
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org 安装的包名字.whl
至此,我这边就不再报这个证书问题了~
在之前用conda指令安装库或者创建环境时遇到无法安装(由于源的问题)的情况,在这也说下源配置的问题:
参考的文章很多,比如:
anaconda conda 切换为国内源
和
Anaconda 3 更换国内清华源教程(看不懂你打我)
我这边在ubuntu下配置的condarc内容如下(其中#表示注释掉了那行,网上很多源中地址是https,我这边试了下http的成功了,算是提供参考,具体问题可参考上面两篇链接)——
channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- http://mirrors.aliyun.com/pypi/simple/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/fastai/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
#- defaults
show_channel_urls: true
#channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
#default_channels:
# - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
# - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
# - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
# - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
# - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
#custom_channels:
# conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
# msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
# bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
# menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
# pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
# simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
其中defaults建议注释掉,默认是anaconda的源下载,比较慢~
There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.org‘,port=443)
Could not fetch URL https://pypi.org/simple/yacs/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/yacs/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERT.
python
pip
3 执行时,出现如下情况:
WARN
ING
:
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
confirm
ing
the
ssl
certificate
:
HTTPS
Connection
Pool
(
host
='
pypi
.
org
',
port
=
443
): Max retrie
最近在Ubuntu16.04上
安装
Python3.6之后,使用
pip
命令出现了
问题
,提示说找不到
ssl
模块,出现错误如下:
pip
is configured with locations that require TLS/
SSL
, however the
ssl
module in Python is not available.
Could not fetch URL
https
:*******: There was a
problem
confirm
ing
the
ssl
certificate
:
Can't connect to
HTTPS
URL because the
SSL
m
使用python直接使用
pip
install xx时,出现 Could not fetch URL
https
://
pypi
.python.
org
/simple/requests/: There was a
problem
confirm
ing
the
ssl
certificate
: [
SSL
:
CERTIFICATE
_VERIFY_FAILED]
certificate
verify faile 这种错误,可以用以下方法解决。本人也是拜访无数帖子,尝试了几个小时弄好的,希望可以给大家节省点时间。
一、错误提示
碰到这个
问题
,主要原因是网站
pypi
.python.
org
在国内是被墙
Could not fetch URL
https
://
pypi
.
org
/simple/jsonpath/: There was a
problem
confirm
ing
the
ssl
certificate
:
HTTPS
Connection
Pool
(
host
=’
pypi
.
org
’,
port
=
443
): Max retries exceeded with url: /simple/jsonpath/ (Caused by
SSL
Error(
SSL
CertVerificationError(1, ‘[
SSL
:
CERTIFICATE
_VERIFY_FAILED]
certificate
ve
Could not fetch URL
https
://
pypi
.
org
/simple/pytest-html/: There was a
problem
confirm
ing
the
ssl
certificate
:
HTTPS
Connection
Pool
(
host
='
pypi
.
org
',
port
=
443
): Max retries exceeded
with url: /simple/pytest-html/ (Caused by
SSL
Error(
SSL
E
遇到的
问题
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
confirm
ing
the
ssl
certificate
:
HTTPS
Connection
Pool
(
host
=‘
pypi
.
org
’, por
could not fetch url
https
://
pypi
.
org
/simple/
pip
/: there was a
problem
confirm
ing
the
ssl
certificate
:
https
connection
pool
(
host
='
pypi
.
org
',
port
=
443
): max retries exceeded with url: /simple/
pip
/ (caused by
ssl
error(
ssl
eoferror(8, 'eof occurred in violation