树莓派入门笔记2-软件安装和pip安装

软件安装命令apt-get

安装包

sudo apt-get install xxx

强制安装

sudo apt-get -f install xxx

重新安装

sudo apt-get reinstall xxx

删除包

sudo apt-get remove xxx

删除包,包括删除配置文件等

sudo apt-get remove xxx --purge
  • 删除包及其依赖的软件包+配置文件等(只对6.10有效,强烈推荐)

sudo apt-get autoremove xxx --purge

更新软件列表

sudo apt-get update

更新所有已安装的包

sudo apt-get upgrade

升级系统

sudo apt-get dist-upgrade

下载该包的源代码

apt-get source xxx

清理下载文件的存档 && 只清理过时的包

sudo apt-get clean && sudo apt-get autoclean

检查是否有损坏的依赖

sudo apt-get check

注:apt-get新下载的软件包位置

/var/cache/apt/archieve下的都是软件的安装缓存
sudo apt-get autoclean(只删除低版本的deb包)
sudo apt-get clean(全部删除)
一般的deb包都安装在:/usr/usr/share/usr/local目录中


参考链接https://www.jianshu.com/p/a52a9d30f903

更换国内源

在终端输入以下指令

sudo nano /etc/apt/sources.list

用#注释掉原文件内容,用以下内容取代:

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

这里我用的是是清华源,在后面若下载出错换中科大源试试(Ps:中科大的源地址http://mirrors.ustc.edu.cn/raspbian/raspbian/
对应替换就行)

注意:网上很多是 stretch ,这是以前的版本 , 现在已经改成 buster了,之前博主就是因为这个无限黑屏。
所以如果你的树莓派版本较新的话就用我这个代码就行,老版本的自行备份测试。
如图:
然后ctrl+o保存,点回车确认保存,然后ctrl+x退出

②在终端输入以下指令**

sudo nano /etc/apt/sources.list.d/raspi.list

用#注释掉原文件内容,用以下内容取代:

deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

如图:

然后ctrl+o保存,点回车确认保存,然后ctrl+x退出

③使用命令更新软件源列表,同时检查编辑是否正确。再更新软件

sudo apt-get update
  sudo apt-get upgrade
————————————————
原文链接:https://blog.csdn.net/weixin_43287964/article/details/101696036

pip3

基本指令

安装pip3

sudo apt install python3-pip

升级pip3

系统虽然给出了更新pip的命令,建议使用

sudo pip3 install --upgrade pip

来更新pip3。

pip和pip3的区别

python 有python2和python3的区别
那么pip也有pip和pip3的区别
pip是python的包管理工具,pip和pip3版本不同,都位于Scripts\目录下:
如果系统中只安装了Python2,那么就只能使用pip。
如果系统中只安装了Python3,那么既可以使用pip也可以使用pip3,二者是等价的。
如果系统中同时安装了Python2和Python3,则pip默认给Python2用,pip3指定给Python3用。

依赖包介绍

某些包依赖于其他软件包,以便操作。一种编程语言,可以依赖于一种编译器,一个游戏引擎图形文件等。这些在Linux中被称为依赖性

以来是使用包管理器而不是手动安装软件的最大原因之一。如果某个包依赖于其他包,apt会自动找到它们,并准备安装它们。如果发生这种情况,会给出一个提示,询问是否要继续。

如果继续,键盘输入字母Y,然后按ENTER 键。(取消安装则输入字母N ,如果在安装中想取消安装则需要按CTRL+C)


原文链接:https://blog.csdn.net/DarrenXf/article/details/82952004

更换国内源

pip更换为国内源,可以大大的提高安装成功率和速度。

先创建文件夹,再创建这个文件

  1 mkdir ~/.pip
  2 nano ~/.pip/pip.conf

添加以下内容

   [global]
   timeout =6000
   index-url =http://pypi.douban.com/simple/
   [install]
   use-mirrors =true
   mirrors =http://pypi.douban.com/simple/
   trusted-host =pypi.douban.com

国内源列表
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣 http://pypi.douban.com/simple
Python官方 https://pypi.python.org/simple/
v2ex http://pypi.v2ex.com/simple/
中国科学院 http://pypi.mirrors.opencas.cn/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
————————————————
参考链接https://blog.csdn.net/qq_40584960/article/details/86080904


临时从镜像源上安装

pip安装文件的时候使用: pip install <包名> –trusted-host pypi.douban.com

比如: pip install pyquery –trusted-host pypi.douban.com

以安装 django 为例:
pip install -i https://pypi.doubanio.com/simple/ Django
pip install -i https://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com Djang

注:
-i https://pypi.doubanio.com/simple/   ------表示使用豆瓣源 (-i == --index-url)
--trusted-host pypi.doubanio.com       --------表示添加信任

原文链接:https://blog.csdn.net/wls666/article/details/95456309

猜你喜欢

转载自www.cnblogs.com/nightowl/p/10668933.html