第一种情况:在确定网络连接和质量没问题的情况下,任何软件都无法安装,出现E:无法定位XXX
解决:换源
具体步骤:
备份 /etc/apt/sources.list 文件
执行命令
sudo cp /etc/apt/sources.list /etc/apt/sources.list.old
打开文件 sudo vim /etc/apt/sources.list (gedit也可以)
将原文件里面的内容删掉或注释掉
粘贴选择的源:
阿里云源:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
清华源:
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main universe restricted multiversedeb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse
sudo apt-get update
第二种情况:可以安装其他的软件,但唯独无法安装ros-
1.echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/ros-latest.list2.sudo apt update然后安装ros-melodic-xxx类的软件包就好使了。
来源地址:https://blog.csdn.net/m0_45805756/article/details/126310136