我使用的是 Debian10/KDE,几个月前就保留了一个软件包。但是,当使用sudo apt update
而不是 时sudo apt-get update
,它会显示其他内容并允许查看“附加版本”。
这是为什么?这不应该也用 apt-get 显示吗?难道不应该简单地安装2.8.5版本吗? (为什么不行?怎么安装?)
sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
python3-psycopg2
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
sudo apt update
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
apt list --upgradable
Listing... Done
python3-psycopg2/stretch-pgdg 2.8.5-1~pgdg90+1 amd64 [upgradable from: 2.7.7-1]
N: There is 1 additional version. Please use the '-a' switch to see it
apt list --upgradable -a
Listing... Done
python3-psycopg2/stretch-pgdg 2.8.5-1~pgdg90+1 amd64 [upgradable from: 2.7.7-1]
python3-psycopg2/stable,now 2.7.7-1 amd64 [installed,upgradable to: 2.8.5-1~pgdg90+1]
尝试进一步调试:
apt policy python3-psycopg2
python3-psycopg2:
Installed: 2.7.7-1
Candidate: 2.8.5-1~pgdg90+1
Version table:
2.8.5-1~pgdg90+1 500
500 http://apt.postgresql.org/pub/repos/apt stretch-pgdg/main amd64 Packages
*** 2.7.7-1 500
500 http://ftp.XX.debian.org/debian buster/main amd64 Packages
100 /var/lib/dpkg/status
sudo apt install python3-psycopg2
Reading package lists... Done
Building dependency tree
Reading state information... Done
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:
python3-psycopg2 : Depends: python3 (< 3.6) but 3.7.3-1 is to be installed
E: Unable to correct problems, you have held broken packages.
与链接的问题不同,通常的问题sudo apt-get --with-new-pkgs upgrade
在这里不起作用:
sudo apt-get --with-new-pkgs upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
无论解决方案是什么:运行时至少应该有一个提示sudo apt-get upgrade
来安装或不安装该新版本。
答案1
在您的 Postgresql 存储库中将stretch
代号更改为buster
:
sudo sed -i 's/stretch/buster/' /etc/apt/sources.list.d/pgdg.list
然后运行:
sudo apt update
sudo apt upgrade
python3-psycopg2/stretch-pgdg 2.8.5-1~pgdg90+1 amd64 [可升级自:2.7.7-1]
debian 存储库提供的安装版本python3-psycopg2
需要升级为2.8.5-1~pgdg90+1
postgresql 存储库提供的版本。但在升级之前,您需要设置正确的存储库,该存储库指向 debian Buster 而不是Stretch
当前设置的。