1.换完清华源之后我又遇到了问题
通过gpt他告诉我,修复异常可以试试sudo apt install -f
Some packages could not be installed. This may mean that you have requested
错误描述 — 在运行 sudo apt upgrade 时,出现以下报错:
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: openjdk-8-jdk : Depends: openjdk-8-jre (= 8u372-ga~us1-0ubuntu1~18.04) but it is not going to be installed 无法安装某些软件包。这可能意味着你有 要求一个不可能的情况下,或者如果您使用的是不稳定的 发行版,一些所需的软件包尚未创建 或者被移出了接收室。 以下信息可能有助于解决此问题: 以下软件包具有未满足的依赖项: openjdk-8-jdk:取决于:openjdk-8-jre(=8u372-ga~us1-0ubuntu1~18.04)但它不会被安装
然后发现搜索+询问发现:Ubuntu每次发行版本的Codename都不一样
需要修改配置文件
解决方法
执行以下命令:(打开内部的配置文件,可以一个一个执行,也可以分开执行,要是一次不行就分开,一步一步去执行)
sudo gedit /etc/apt/sources.list
据自己的系统版号,选择正确的源。例如Ubuntu 20.04,更换文件中的内容如下
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
这时候狗哥快乐的搜素openjdk-8
问题狗哥快快乐乐的搜索的是8啊,怎么变成11了
那我的openjdk8下载没啊,我抱着怀疑的态度,又卸载重装,结果还是这个结果
首先,先下好JDK版本,并进行安装,并对JDK进行配置
先运行
update-alternatives --display java
打开JDK的配置文件
sudo update-alternatives --config java
root@iZbp1gpcuk3j9kmdbbfrywZ:~# sudo update-alternatives --config java There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode 1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode 要维持当前值[*]请按<回车键>,或者键入选择的编号:2 Press <enter> to keep the current choice[*], or type selection number: 2 update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode