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保存退出编辑器,回到命令行界面。


参考资料

扫描二维码关注公众号,回复: 11848565 查看本文章

猜你喜欢

转载自blog.csdn.net/Naiva/article/details/105216383