conda更换国内源
时间: 2023-08-27 08:21:07 浏览: 668
你可以通过以下步骤更换Conda的国内源:
1. 打开终端或命令提示符窗口。
2. 输入以下命令,备份原始的.condarc文件(如果存在):
```
cp ~/.condarc ~/.condarc.backup
```
3. 输入以下命令,创建或编辑.condarc文件:
```
conda config --set show_channel_urls yes
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 --set default_channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set channel_priority strict
```
4. 保存并关闭文件。
现在,你的Conda将使用清华大学镜像站点作为默认源。你可以使用以下命令验证更改是否生效:
```
conda info
```
希望对你有所帮助!如果有任何其他问题,请随时提问。
相关问题
conda 更换国内源
conda是一个Python的数据包管理工具,如果你想更换成国内的源以提高下载速度,可以按照以下步骤操作:
1. **创建一个新的环境**:
```shell
conda create --name my_new_env
```
2. **切换到新环境**:
```shell
conda activate my_new_env
```
3. **配置国内镜像仓库**:
导入Anaconda的国内镜像列表(如清华大学、阿里云等):
```shell
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/free/
```
或者你可以选择你喜欢的具体镜像源,替换上述命令中的URL。
4. **更新或安装包**:
安装新的包时,Conda会优先从设置的镜像源下载:
```shell
conda install package_name -c defaults
```
`-c defaults` 表示默认的官方仓库,你可以替换为添加的国内镜像仓库名。
5. **验证是否成功切换**:
查看当前活跃的源可以确认:
```shell
conda config --get channels
```
conda更换国内源最新
conda更换国内源最新的方法有两种。第一种是通过修改.condarc文件来更换源。你可以在.condarc文件中加入以下内容:
channels:
- defaults
show_channel_urls: true
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/
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
这样就可以将国内镜像源设置为清华大学镜像源,从而加快下载速度。
第二种方法是通过cmd命令行添加镜像源。可以使用以下命令行代码:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.***.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.***
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![txt](https://img-home.csdnimg.cn/images/20241231045021.png)
![txt](https://img-home.csdnimg.cn/images/20241231045021.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)