无法在 ubuntu 18.04.4 上安装 python3-dev

无法在 ubuntu 18.04.4 上安装 python3-dev

python3-dev安装时ubuntu 18.04.4我遇到以下问题

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.6/libpython3.6-dev_3.6.9-1~18.04ubuntu1_amd64.deb  404  Not Found [IP: 43.255.166.254 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.6/python3.6-dev_3.6.9-1~18.04ubuntu1_amd64.deb  404  Not Found [IP: 43.255.166.254 80]

据我观察python3.6-dev_3.6.9-1~18.04ubuntu1_amd64.deb,这些包libpython3.6-dev_3.6.9-1~18.04ubuntu1_amd64.deb不可用相反 python3.6-dev_3.6.9-1~18.04ubuntu1.1_amd64.deblibpython3.6-dev_3.6.9-1~18.04ubuntu1.1_amd64.deb是可用的。(注意ubuntu1和ubuntu1.1的区别)

我尝试手动下载并安装python3.6-dev_3.6.9-1~18.04ubuntu1.1_amd64.deb软件包libpython3.6-dev_3.6.9-1~18.04ubuntu1.1_amd64.deb,但出现以下错误

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libpython3.6-dev : Depends: libpython3.6-stdlib (= 3.6.9-1~18.04ubuntu1.1) but 3.6.9-1~18.04ubuntu1 is to be installed
                    Depends: libpython3.6 (= 3.6.9-1~18.04ubuntu1.1) but 3.6.9-1~18.04ubuntu1 is to be installed
 python3-dev : Depends: libpython3-dev (= 3.6.7-1~18.04) but it is not going to be installed
               Depends: python3.6-dev (>= 3.6.7-1~) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).`

日志

$ sudo apt-get install python3-dev/bionic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Selected version '3.6.7-1~18.04' (Ubuntu:18.04/bionic-updates [amd64]) for 'python3-dev'
Selected version '3.6.7-1~18.04' (Ubuntu:18.04/bionic-updates [amd64]) for 'libpython3-dev' because of 'python3-dev'
Selected version '3.6.9-1~18.04ubuntu1' (Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic-security [amd64]) for 'python3.6-dev' because of 'python3-dev'
The following additional packages will be installed:
  libpython3-dev libpython3.6-dev python3.6-dev
The following NEW packages will be installed:
  libpython3-dev libpython3.6-dev python3-dev python3.6-dev
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 45.4 MB/45.4 MB of archives.
After this operation, 76.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Ign:1 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython3.6-dev amd64 3.6.9-1~18.04ubuntu1
Ign:2 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3.6-dev amd64 3.6.9-1~18.04ubuntu1
Err:1 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 libpython3.6-dev amd64 3.6.9-1~18.04ubuntu1
  404  Not Found [IP: 43.255.166.254 80]
Err:2 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 python3.6-dev amd64 3.6.9-1~18.04ubuntu1
  404  Not Found [IP: 43.255.166.254 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.6/libpython3.6-dev_3.6.9-1~18.04ubuntu1_amd64.deb  404  Not Found [IP: 43.255.166.254 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.6/python3.6-dev_3.6.9-1~18.04ubuntu1_amd64.deb  404  Not Found [IP: 43.255.166.254 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

答案1

最后通过从 dpkg 中删除其他架构解决了这个问题

sudo apt-get remove --purge `dpkg --get-selections | awk '/arm64/{print $1}'`

sudo apt-get remove --purge `dpkg --get-selections | awk '/armhf/{print $1}'`

sudo dpkg --remove-architecture armhf

sudo dpkg --remove-architecture arm64

相关内容