问题
sudo: apt-get: command not found
问题描述
# 树莓派需要安装xxx应用
# 由于强制安装xxx包,导致apt相关命令被删除
# 执行apt-get install 或者 apt-get update 等指令均提示:
# sudo: apt-get: command not found
解决方式
1. 查看 sources.list
root@raspberrypi:~ # cat /etc/apt/sources.list
deb http://mirrors.aliyun.com/raspbian/raspbian/ wheezy main non-free contrib
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ wheezy main non-free contrib
2. 找到当前使用的mirror
http://mirrors.aliyun.com/raspbian/raspbian/
3. 找到相应的deb, 下载到本地
# 我需要的是 apt_xxx.deb
# 所以后缀 /pool/main/a/apt/
# 包名 apt_xxx.deb xxx为数字版本号
wget http://mirrors.aliyun.com/raspbian/raspbian/pool/main/a/apt/apt_0.9.7.9+rpi1+deb7u7_armhf.deb
4. 安装deb
sudo dpkg -i apt_0.9.7.9+rpi1+deb7u7_armhf.deb
其他指令缺失时, 解决方式类似