python 中 apt 包损坏

python 中 apt 包损坏

我在 Ubuntu 18.04 上安装了 Python 3.7.5,并将替代方案更新pythonpython3Python 3.7.5。之后我遇到了很多问题。

当我使用sudo apt-get updatesudo gdebi some_deb_file出现此错误时:

No module named apt_pkg

我将替代方案更新为pythonPython 2.7(Ubuntu 18.04 默认),但没有作用。

我搜索并找到了这个解决方案:

cd /usr/lib/python3/dist-packages/
sudo ln -s apt_pkg.cpython-36m-x86_64-linux-gnu.so apt_pkg

现在,当我使用时sudo gdebi some_deb_file,出现此错误:

Traceback (most recent call last):
  File "/usr/bin/gdebi", line 38, in <module>
    from GDebi.GDebiCli import GDebiCli
  File "/usr/share/gdebi/GDebi/GDebiCli.py", line 36, in <module>
    from .DebPackage import DebPackage, DscSrcPackage
  File "/usr/share/gdebi/GDebi/DebPackage.py", line 24, in <module>
    import apt.debfile
  File "/usr/lib/python3/dist-packages/apt/debfile.py", line 23, in <module>
    import apt_inst
ModuleNotFoundError: No module named 'apt_inst'

当我使用时,sudo apt-get update我得到了这个:

Hit:1 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease    
Ign:2 http://dl.google.com/linux/chrome/deb stable InRelease                   
Hit:3 http://security.ubuntu.com/ubuntu bionic-security InRelease              
Hit:4 http://dl.google.com/linux/chrome/deb stable Release                     
Hit:5 https://ocean.surfshark.com/debian stretch InRelease                     
Hit:6 http://ir.archive.ubuntu.com/ubuntu bionic InRelease                     
Hit:7 http://ppa.launchpad.net/noobslab/apps/ubuntu bionic InRelease           
Hit:9 http://ir.archive.ubuntu.com/ubuntu bionic-updates InRelease             
Hit:10 http://packages.ros.org/ros/ubuntu bionic InRelease                     
Get:11 https://dl.winehq.org/wine-builds/ubuntu bionic InRelease [6,259 B]     
Hit:12 http://ppa.launchpad.net/plushuang-tw/uget-stable/ubuntu bionic InRelease
Hit:13 http://ir.archive.ubuntu.com/ubuntu bionic-backports InRelease          
Err:11 https://dl.winehq.org/wine-builds/ubuntu bionic InRelease               
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
Ign:14 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic InRelease        
Get:15 https://dl.winehq.org/wine-builds/ubuntu xenial InRelease [6,259 B]     
Err:16 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release    
  404  Not Found [IP: 91.189.95.83 80]
Err:15 https://dl.winehq.org/wine-builds/ubuntu xenial InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
Reading package lists... Done 
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu bionic InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu xenial InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

现在,当我使用时python,它会运行python2.7.17并成功导入apt_pkgapt_inst,但是当我使用时python3,它会运行Python 3.7.5并成功导入apt_pkg,但无法导入apt_inst

感谢@JerareYoshi,我尝试从 PPA 列表中删除 Xenial,但是,正如我所说,软件和更新应用程序无法打开,所以我尝试使用ppa-purge它来删除它(但我不知道我是否使用正确)并且当我想使用时出现此错误sudo ppa-purge -o wine-builds/ubuntu xenial

Updating packages lists
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu bionic InRelease' is not signed.
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu xenial InRelease' is not signed.
E: The repository 'http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release' does not have a Release file.
Warning:  apt-get update failed for some reason

之后我搜索了 PPA 列表,但没有找到 Xenial。

输出apt policy

Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 https://ocean.surfshark.com/debian stretch/main i386 Packages
     release o=Surfshark,n=stretch,l=Surfshark packages,c=main,b=i386
     origin ocean.surfshark.com
 500 https://ocean.surfshark.com/debian stretch/main amd64 Packages
     release o=Surfshark,n=stretch,l=Surfshark packages,c=main,b=amd64
     origin ocean.surfshark.com
 500 http://packages.ros.org/ros/ubuntu bionic/main i386 Packages
     release o=ROS,a=bionic,n=bionic,l=ROS bionic,c=main,b=i386
     origin packages.ros.org
 500 http://packages.ros.org/ros/ubuntu bionic/main amd64 Packages
     release o=ROS,a=bionic,n=bionic,l=ROS bionic,c=main,b=amd64
     origin packages.ros.org
 500 http://ppa.launchpad.net/plushuang-tw/uget-stable/ubuntu bionic/main i386 Packages
     release v=18.04,o=LP-PPA-plushuang-tw-uget-stable,a=bionic,n=bionic,l=uGet stable version,c=main,b=i386
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/plushuang-tw/uget-stable/ubuntu bionic/main amd64 Packages
     release v=18.04,o=LP-PPA-plushuang-tw-uget-stable,a=bionic,n=bionic,l=uGet stable version,c=main,b=amd64
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/noobslab/apps/ubuntu bionic/main i386 Packages
     release v=18.04,o=LP-PPA-noobslab-apps,a=bionic,n=bionic,l=Apps collection by NoobsLab.com,c=main,b=i386
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/noobslab/apps/ubuntu bionic/main amd64 Packages
     release v=18.04,o=LP-PPA-noobslab-apps,a=bionic,n=bionic,l=Apps collection by NoobsLab.com,c=main,b=amd64
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic/main i386 Packages
     release v=18.04,o=LP-PPA-graphics-drivers,a=bionic,n=bionic,l=Proprietary GPU Drivers,c=main,b=i386
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic/main amd64 Packages
     release v=18.04,o=LP-PPA-graphics-drivers,a=bionic,n=bionic,l=Proprietary GPU Drivers,c=main,b=amd64
     origin ppa.launchpad.net
 500 http://dl.google.com/linux/chrome/deb stable/main amd64 Packages
     release v=1.0,o=Google LLC,a=stable,n=stable,l=Google,c=main,b=amd64
     origin dl.google.com
 500 http://security.ubuntu.com/ubuntu bionic-security/multiverse i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=multiverse,b=i386
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=multiverse,b=amd64
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/universe i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=universe,b=i386
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=universe,b=amd64
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/restricted i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=restricted,b=i386
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=restricted,b=amd64
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/main i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=main,b=i386
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=main,b=amd64
     origin security.ubuntu.com
 100 http://ir.archive.ubuntu.com/ubuntu bionic-backports/universe i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-backports,n=bionic,l=Ubuntu,c=universe,b=i386
     origin ir.archive.ubuntu.com
 100 http://ir.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-backports,n=bionic,l=Ubuntu,c=universe,b=amd64
     origin ir.archive.ubuntu.com
 100 http://ir.archive.ubuntu.com/ubuntu bionic-backports/main i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-backports,n=bionic,l=Ubuntu,c=main,b=i386
     origin ir.archive.ubuntu.com
 100 http://ir.archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-backports,n=bionic,l=Ubuntu,c=main,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/multiverse i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=multiverse,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=multiverse,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=universe,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=universe,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/restricted i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=restricted,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=restricted,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=main,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=main,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/multiverse i386 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=multiverse,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=multiverse,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/universe i386 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=universe,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=universe,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/restricted i386 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=restricted,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=restricted,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/main i386 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=main,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=main,b=amd64
     origin ir.archive.ubuntu.com
Pinned packages:

输出ls -lh /etc/apt/sources.list.d

total 56K
-rw-r--r-- 1 root root 189 Mar 19 13:25 google-chrome.list
-rw-r--r-- 1 root root 189 Mar 19 13:25 google-chrome.list.save
-rw-r--r-- 1 root root 219 Mar 19 13:25 graphics-drivers-ubuntu-ppa-bionic.list
-rw-r--r-- 1 root root 219 Mar 19 13:25 graphics-drivers-ubuntu-ppa-bionic.list.save
-rw-r--r-- 1 root root 470 Mar 19 13:25 noobslab-ubuntu-apps-bionic.list
-rw-r--r-- 1 root root 470 Mar 19 13:25 noobslab-ubuntu-apps-bionic.list.save
-rw-r--r-- 1 root root 152 Mar 19 13:25 plushuang-tw-ubuntu-uget-stable-bionic.list
-rw-r--r-- 1 root root 152 Mar 19 13:25 plushuang-tw-ubuntu-uget-stable-bionic.list.save
-rw-r--r-- 1 root root  51 Mar 19 13:25 ros-latest.list
-rw-r--r-- 1 root root  51 Mar 19 13:25 ros-latest.list.save
-rw-r--r-- 1 root root  52 Mar 19 13:25 surfshark.list
-rw-r--r-- 1 root root  52 Mar 19 13:25 surfshark.list.save
-rw-r--r-- 1 root root 274 Mar 19 13:25 ubuntu-wine-ubuntu-ppa-bionic.list
-rw-r--r-- 1 root root 204 Mar 19 13:25 ubuntu-wine-ubuntu-ppa-bionic.list.save

正如我所说,没有 Xenial。

但是现在,当我运行时sudo apt-get update,我再次收到此消息:

Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]                                                                  
Ign:2 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                 
Hit:3 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease                                                                  
Hit:4 http://ir.archive.ubuntu.com/ubuntu bionic InRelease                                                                                   
Hit:5 http://dl.google.com/linux/chrome/deb stable Release                                                                                   
Hit:6 https://ocean.surfshark.com/debian stretch InRelease                                                                                   
Hit:8 http://ppa.launchpad.net/noobslab/apps/ubuntu bionic InRelease                                                                         
Hit:9 http://ir.archive.ubuntu.com/ubuntu bionic-updates InRelease                                                                           
Hit:10 http://packages.ros.org/ros/ubuntu bionic InRelease                                                                                   
Hit:11 http://ir.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                        
Hit:12 http://ppa.launchpad.net/plushuang-tw/uget-stable/ubuntu bionic InRelease          
Get:13 http://security.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [38.5 kB]                              
Get:14 https://dl.winehq.org/wine-builds/ubuntu bionic InRelease [6,259 B]                                                                   
Err:14 https://dl.winehq.org/wine-builds/ubuntu bionic InRelease                                                                             
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
Get:15 http://security.ubuntu.com/ubuntu bionic-security/main DEP-11 48x48 Icons [17.6 kB]                                
Get:16 http://security.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons [41.5 kB]                  
Get:17 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [42.1 kB]                                   
Get:18 http://security.ubuntu.com/ubuntu bionic-security/universe DEP-11 48x48 Icons [16.4 kB]                                           
Get:19 http://security.ubuntu.com/ubuntu bionic-security/universe DEP-11 64x64 Icons [111 kB]                                              
Ign:20 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic InRelease                                   
Get:21 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]                     
Err:22 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release                                                                        
  404  Not Found [IP: 91.189.95.83 80]
Get:23 https://dl.winehq.org/wine-builds/ubuntu xenial InRelease [6,259 B]
Err:23 https://dl.winehq.org/wine-builds/ubuntu xenial InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
Reading package lists... Done 
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu bionic InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu xenial InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

相关内容