Ubuntu apt-get和pip源更換
阿新 • • 發佈:2018-05-14
all pda 執行命令 內容 -a 科學 大學 HR code
Ubuntu apt-get和pip源更換
更新數據源為國內,是為了加速安裝包的增加速度。
更換apt-get數據源
- 輸入:sudo -s切換為root超級管理員;
- 執行命令:vim /etc/apt/sources.list;
- 使用命令:%d 清空所有內容;
- 清華數據源地址:https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ 選擇相應的版本復制內容,點擊“i”鍵進入編輯文本模式,粘貼內容到vim編輯窗體,點擊“ESC”鍵進入編輯模式,輸入“:wq”保存離開;
- 更新源:sudo apt-get update;
- 更新軟件:sudo apt-get upgrade;
pip3的安裝與升級
安裝pip3:sudo apt-get install python3-pip
升級pip3:sudo pip install --upgrade pip
查看pip版本:pip -V
pip源更換
- 根目錄創建.pip文件:mkdir ~/.pip;
- 創建文件pip.conf:vim .pip/pip.conf;
點擊“i”鍵,進入編輯模式,復制信息:
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple trusted-host = pypi.tuna.tsinghua.edu.cn
這個更換的是清華的源,清華的源5分鐘同步官網一次,建議使用。
阿裏雲 http://mirrors.aliyun.com/pypi/simple/
中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
中國科學技術大學 http://pypi.mirrors.ustc.edu.cn/simple/點擊:“ESC”切換到命令行模式,輸入“:wq”保存離開。
Ubuntu apt-get和pip源更換