Raspberry Pi 4B樹莓派 | #入門教程08#一勞永逸配置樹莓派(更換國內源)

Q : 爲什麼要切換到國內的apt-get下載源和pip下載源?

A : 防止下載速度過慢。

終端鍵入一下命令:

	sudo nano /etc/apt/sources.list

在第一行開頭加一個#號註釋掉,把下面的內容拷貝到最後一行(注意安裝的樹莓派系統版本:Debian 10 Buster、 Stretch、Jessie)。

如圖中的效果:

	deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
	deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

注意:
在這裏插入圖片描述

先按鍵盤上的ctrl+x,再按回車保存,再按yenter退出nano編輯器回到命令行界面。再輸入以下命令更新到清華大學鏡像源最新的軟件列表。

	sudo apt-get update 

給pip換源:

	sudo mkdir ~/.pip
	ls .pip
	sudo nano pip.conf

在打開的文件中輸入以下內容:

[global]
timeout = 10
index-url =  http://mirrors.aliyun.com/pypi/simple/
extra-index-url= http://pypi.douban.com/simple/
[install]
trusted-host=
	mirrors.aliyun.com
	pypi.douban.com

先按鍵盤上的ctrl+x,再按yenter保存退出編輯器,回到命令行界面。


參考資料

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章