ubuntu pip换源
时间: 2023-04-09 18:01:02 浏览: 270
pip.ini文件安装,一键换源
可以使用以下命令将pip源更换为清华大学的源:
1.备份原有的源文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2.编辑源文件
sudo gedit /etc/apt/sources.list
3.将原有的源地址替换为清华大学的源地址
将以下内容添加到文件末尾:
#清华大学源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
4.更新源
sudo apt-get update
5.安装pip
sudo apt-get install python-pip
6.升级pip
sudo pip install --upgrade pip
这样就可以将pip源更换为清华大学的源了。
阅读全文