參考https://www.cnblogs.com/vipstone/p/9038023.html
更換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
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分鐘同步官網一次,建議使用。
清華大學 https://pypi.tuna.tsinghua.edu.cn/simple/
阿里雲 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”保存離開。
使用gedit更加方便