在我设置好国内源之后,用conda创建虚拟环境,下载python版本时出现以下错误。
Solving environment: failed CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/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/free/noarch/repodata.json (Caused by SSLError(SSLError(“bad handshake: Error([(‘SSL routines’, ‘ssl3_get_server_certificate’, ‘certificate verify failed’)],)”,),))’,),)
我的~/.condarc
内容(即conda channels设置)如下
channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64 show_channel_urls: true
在我查阅了多篇博客,尝试了多种方案之后,终于找到两种解决方案:
conda config --set ssl_verify false
修改设置,或者在文件~/.condarc
末尾添加一行ssl_verify: false
(有则修改即可)两种方法选一种即可
https协议比http协议多了SSL,TLS等验证和加密的阶段,可能是在与清华源进行SSL验证的过程中会出问题,因此需要关掉SSL验证,或者改用http协议。但是使用SSL验证是有助于保障传输过程的可靠性的。
Copyright © 2013-2021 8a.hk All Rights Reserved. 八艾云 版权所有 中山市八艾云计算有限公司 粤ICP备14095776号