在anaconda命令行中,执行命令报SSLError
报错信息如下:
(base) C:\Users\thirsd>conda create --name pytorch python=3.7
Solving environment: failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch/repodata.json
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
SSLError(MaxRetryError('HTTPSConnectionPool(host='mirrors.tuna.tsinghua.edu.cn', port=443): Max retries exceeded with url: /anaconda/pkgs/main/noarch/repodata.json (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')])")))'))
解决方法: 关闭ssl认证
方法1:修改配置文件.condarc
(位置在家目录下,windows下在C:\Users\你的账户名;linux下在~/下)
设置ssl_verify为false,可以规避SSL报错。
ssl_verify: false
或者:
方法2:通过命令行方式
conda config --set ssl_verify false
网友评论