简介:Conda 是一个开源的软件包管理系统和环境管理系统,用于安装多个版本的软件包及其依赖关系,并在它们之间轻松切换。Conda 是为 Python 程序创建的,适用于 Linux,OS X 和Windows,也可以打包和分发其他软件。由于某些原因,有时我们需要设置国内源,优化网络配置。
历史攻略:
pip安装第三方库全攻略:普通安装、安装whl后缀文件、使用国内镜像安装
操作步骤:
# 删除默认的conda镜像源
conda config --remove channels defaults
# 添加国内的镜像源 - 清华镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
# 验证配置
conda config --show channels
# 清除缓存
conda clean -i
运行参考结果:
(py312) tom@tom:~/tests$ conda config --remove channels defaults
(py312) tom@tom:~/tests$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
(py312) tom@tom:~/tests$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
(py312) tom@tom:~/tests$ conda config --show channels
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
(py312) tom@tom:~/tests$ conda clean -i
Will remove 1 index cache(s).
Proceed ([y]/n)? y
(py312) tom@tom:~/tests$ conda config --show channels
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
(py312) tom@tom:~/tests$
标签:channels,--,配置,国内,conda,tom,edu,config
From: https://blog.csdn.net/hzblucky1314/article/details/141304377