apt-get
apt(advanced package tool):管理Ubuntu软件包
apt在etc/apt/sources.list 里记录了官方库的地址(美国),但是速度不能保证,可以添加清华镜像源
1. 备份sources.list
cp sources.list sources.list .bak
2. 修改sources.list
清空sources.list
echo ' '>sources.list
编辑sources.list
vim sources.list
error : Found a swap file by the name ".sources.list.swp"
解决方法:rm .sources.list.swp
在清华软件源镜像找到对应系统的镜像,拷贝到sources.list(i:编辑,ESC:退出编辑,:wq :保存退出)
3. 更新
更新源:sudo apt-get update
更新软件:sudo apt-get upgrade
pip
临时使用:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
设为默认:
修改 ~/.config/pip/pip.conf
(没有就创建一个)
mkdir ~/.pip
vim .pip/pip.conf
修改 index-url
至tuna,例如
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
pip 和 pip3 并存时,只需修改 ~/.pip/pip.conf
conda
修改conda源只需如下命令:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes