换源 pip 阿里源 conda 清华源

常规操作,总是用,总是忘,搜质量还良莠不齐,不如自己mark一个可用的版本

起因是今天pip使用豆瓣源报错,也不知道是不是豆瓣的问题

pip换源

windows更换

在这里👀

在用户目录下创建pip文件夹,然后在里面创建pip.ini文件,并贴上以下内容

[global]
timeout = 6000
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com

Linux&Mac

直接修改~/.pip/pip.conf(没有就创建一个),内容如下

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

anaconda 换源

windows更换

直接在命令行中输入以下命令即可添加清华源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
# 设置搜索时显示通道地址
conda config --set show_channel_urls yes

Linux&Mac更换

直接在~/.condarc中写以下文件

channels:
  - https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
  - https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults
show_channel_urls: true

References

https://wuyabala.com/article/32

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容