所有软件包的 apt-get 均失败

所有软件包的 apt-get 均失败

我运行的是 ubuntu 14.04,最近开始遇到 apt-get 问题。我无法安装或删除任何软件包(下面的错误)。我尝试重新安装这些软件包,尝试删除 deb 文件,但仍然遇到相同的错误。

    The following extra packages will be installed:
    python3-software-properties software-properties-common
    software-properties-gtk
    The following packages will be upgraded:
    python3-software-properties software-properties-common
    software-properties-gtk
    3 upgraded, 0 newly installed, 0 to remove and 412 not upgraded.
    108 not fully installed or removed.
    Need to get 0 B/126 kB of archives.
    After this operation, 0 B of additional disk space will be used.
    Do you want to continue? [Y/n] y
    WARNING: The following packages cannot be authenticated!
    dh-python software-properties-common software-properties-gtk
    python3-software-properties
    Install these packages without verification? [y/N] y
    (Reading database ... 305261 files and directories currently         installed.)
    Preparing to unpack .../software-properties-common_0.92.37.7_all.deb ...
    /var/lib/dpkg/info/software-properties-common.prerm: 6: /var/lib/dpkg/info/software-properties-common.prerm: py3clean: not found
    dpkg: warning: subprocess old pre-removal script returned error exit status 127
    dpkg: trying script from the new package instead ...
    /var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
    dpkg: error processing archive /var/cache/apt/archives/software-properties-common_0.92.37.7_all.deb (--unpack):
    subprocess new pre-removal script returned error exit status 127
    /var/lib/dpkg/info/software-properties-common.postinst: 6: /var/lib/dpkg/info/software-properties-common.postinst: py3compile: not found
    dpkg: error while cleaning up:
    subprocess installed post-installation script returned error exit status 127
    Preparing to unpack .../software-properties-gtk_0.92.37.7_all.deb ...
    /var/lib/dpkg/info/software-properties-gtk.prerm: 6: /var/lib/dpkg/info/software-properties-gtk.prerm: py3clean: not found
    dpkg: warning: subprocess old pre-removal script returned error exit status 127
    dpkg: trying script from the new package instead ...
    /var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
    dpkg: error processing archive /var/cache/apt/archives/software-properties-gtk_0.92.37.7_all.deb (--unpack):
    subprocess new pre-removal script returned error exit status 127
    /var/lib/dpkg/info/software-properties-gtk.postinst: 6: /var/lib/dpkg/info/software-properties-gtk.postinst: py3compile: not found
    dpkg: error while cleaning up:
    subprocess installed post-installation script returned error exit status 127
    Preparing to unpack .../python3-software-properties_0.92.37.7_all.deb ...
    /var/lib/dpkg/info/python3-software-properties.prerm: 6: /var/lib/dpkg/info/python3-software-properties.prerm: py3clean: not found
    dpkg: warning: subprocess old pre-removal script returned error exit status 127
    dpkg: trying script from the new package instead ...
    /var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
    dpkg: error processing archive /var/cache/apt/archives/python3-software-properties_0.92.37.7_all.deb (--unpack):
    subprocess new pre-removal script returned error exit status 127
    /var/lib/dpkg/info/python3-software-properties.postinst: 6: /var/lib/dpkg/info/python3-software-properties.postinst: py3compile: not found
    dpkg: error while cleaning up:
    subprocess installed post-installation script returned error exit status 127
    Errors were encountered while processing:
    /var/cache/apt/archives/software-properties-common_0.92.37.7_all.deb
    /var/cache/apt/archives/software-properties-gtk_0.92.37.7_all.deb
    /var/cache/apt/archives/python3-software-properties_0.92.37.7_all.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

py3compile:未找到

py3compile命令是包的一部分python3-minimal,似乎已损坏。

要解决此问题,请尝试以下操作:

  • 通过以下方式纠正依赖关系已损坏的系统:

    sudo apt-get  -f install
    
  • 通过以下方式重新配置所有已解压但未配置的包:

    sudo dpkg --configure -a
    
  • 如果上述方法不起作用,请尝试python3-minimal通过以下方式重新安装软件包:

    sudo apt install -f --reinstall python3-minimal
    

    或者运行:

    apt-get download python3-minimal
    sudo dpkg -i *python3*.deb
    sudo apt install -f
    

    或者下载.pkg来自 kernel.org 的文件并通过以下方式从文件安装:

    sudo dpkg -i python3-minimal_*.deb
    

然后确保py3compile命令py3clean可运行并且可从PATH变量访问。

相关内容