我装了三天三夜的环境,然后一手抖把虚拟机删了,然后重复不知几次之后, 总结出来的经验是一定要先换源
pip
# 豆瓣
https://pypi.doubanio.com/simple/
# 阿里云
https://mirrors.aliyun.com/pypi/simple/
# 清华大学
https://pypi.tuna.tsinghua.edu.cn/simple/
https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/
升级 pip 到最新的版本后进行配置:
pip install pip -U
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/
conda
1.conda源更换为清华
只需输入如下两行命令:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
2.conda源更换为中科大
只需输入如下两行命令:
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
记得删掉c:/usr/usrname里的.condarc原有的清华镜像
3.如果需要换回conda的默认源。查看了conda config的文档后,发现直接删除channels即可。命令如下:
conda config --remove-key channels
apt get
更换方法:
cp /etc/apt/sources.list /etc/apt/sources.list.bak
sed -i 's/:\/\/\(.*\)\//:\/\/<源域名>/g' /etc/apt/sources.list
apt-get update
其中,
清华源域名:mirrors.tuna.tsinghua.edu.cn
中科大源域名:mirrors.ustc.edu.cn
yum
1.首先备份当前配置文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.下载新的 CentOS-Base.repo 到 /etc/yum.repos.d
对于CentOS8
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
- 运行 yum makecache 生成缓存
yum makecache
参考链接:
https://www.jianshu.com/p/bb4bff1f4bbc
https://blog.csdn.net/Arylu/article/details/83659221
https://www.cnblogs.com/believepd/p/10499844.html
https://zhuanlan.zhihu.com/p/106719292