conda源管理
2022/8/17 6:24:20
本文主要是介绍conda源管理,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
第1步:
[email protected]:~$ gedit ~/.condarc
第2步:
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/cloud/conda-forge/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ - https://mirrors.ustc.edu.cn/anaconda/pkgs/main/ - https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ - https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/ - https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/main/ - https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/free/ - https://mirrors.sjtug.sjtu.edu.cn/anaconda/cloud/conda-forge/ ssl_verify: true show_channel_urls: true #changeps1: False
第3步:
save.
第4步:
[email protected]:~$ conda update conda
出现下面的错误:
Solving environment: failed CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.ustc.edu.cn/anaconda/pkgs/free/linux-64/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.bfsu.edu.cn\', port=443): Max retries exceeded with url: /anaconda/pkgs/free/linux-64/repodata.json (Caused by SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'ssl3_get_server_certificate\', \'certificate verify failed\')])")))'))
解决方案:
在我查阅了多篇博客,尝试了多种方案之后,终于找到两种解决方案(https://blog.csdn.net/kxqt233/article/details/121167753):
在命令行中输入conda config --set ssl_verify false修改设置,或者在文件~/.condarc末尾添加一行ssl_verify: false(有则修改即可)
将https改成http
两种方法选一种即可
原因分析
https协议比http协议多了SSL,TLS等验证和加密的阶段,可能是在与清华源进行SSL验证的过程中会出问题,因此需要关掉SSL验证,或者改用http协议。但是使用SSL验证是有助于保障传输过程的可靠性的。
显示现有的源:
conda config --show channels
又出现如下的问题:
Solving environment: failed CondaValueError: Malformed version string '~': invalid character(s).
解决方案(https://stackoverflow.com/questions/56084960/condavalueerror-malformed-version-string-invalid-characters):
I needed to remove conda-forge from my .condarc file. Then everything worked fine.
现在的.condarc文件是:
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/cloud/pytorch/ - https://mirrors.ustc.edu.cn/anaconda/pkgs/main/ - https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ - https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/main/ - https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/free/ ssl_verify: false show_channel_urls: true
conda设置默认源:
最近由于某些因素清华的conda镜像登不上去了,所以需要换回conda的默认源。查看了conda config的文档后,发现直接删除channels即可。命令如下:
conda config --remove-key channels
Anaconda的默认源:
https://repo.anaconda.com/pkgs/main https://repo.anaconda.com/pkgs/r https://repo.anaconda.com/pkgs/msys2
用法:
conda config --add channels https://repo.anaconda.com/pkgs/main conda config --add channels https://repo.anaconda.com/pkgs/r conda config --add channels https://repo.anaconda.com/pkgs/msys2 conda config --set show_channel_urls yes
这篇关于conda源管理的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-15PingCAP 黄东旭参与 CCF 秀湖会议,共探开源教育未来
- 2024-05-13PingCAP 戴涛:构建面向未来的金融核心系统
- 2024-05-09flutter3.x_macos桌面os实战
- 2024-05-09Rust中的并发性:Sync 和 Send Traits
- 2024-05-08使用Ollama和OpenWebUI在CPU上玩转Meta Llama3-8B
- 2024-05-08完工标准(DoD)与验收条件(AC)究竟有什么不同?
- 2024-05-084万 star 的 NocoDB 在 sealos 上一键起,轻松把数据库编程智能表格
- 2024-05-08Mac 版Stable Diffusion WebUI的安装
- 2024-05-08解锁CodeGeeX智能问答中3项独有的隐藏技能
- 2024-05-08RAG算法优化+新增代码仓库支持,CodeGeeX的@repo功能效果提升