AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 989887
Accepted
yukashima huksay
yukashima huksay
Asked: 2017-12-28 04:37:52 +0800 CST2017-12-28 04:37:52 +0800 CST 2017-12-28 04:37:52 +0800 CST

删除python后如何修复未满足的依赖项?

  • 772

我为安装应用程序而苦苦挣扎。在评论中的某个地方,有人说我变得残忍并且做了rm -rf /usr/lib/python2.7,然后我也做了同样的事情。在那之后我sudo apt purge python2.7-minimal现在我的系统完全崩溃了,例如当sudo apt upgrade我得到:

The following packages have unmet dependencies:
 gimp : Depends: python:any (>= 2.6.6-7~)
 libboost-mpi-python1.58.0 : Depends: python (< 2.8) but it is not installed
                             Depends: python (>= 2.7~) but it is not installed
                             Depends: python:any (>= 2.7.5-5~)
 libboost-python1.58-dev : Depends: python-dev but it is not installed
                           Depends: python:any (< 2.8)
                           Depends: python:any (>= 2.7.5-5~)
                           Depends: python (>= 2.5) but it is not installed or
                                    python-celementtree but it is not installable or
                                    python-elementtree but it is not installable
 ndiff : Depends: python:any (< 2.8)
         Depends: python:any (>= 2.7.5-5~)
 python-bs4 : Depends: python:any (< 2.8)
              Depends: python:any (>= 2.7.5-5~)
 python-cairo : Depends: python (< 2.8) but it is not installed
                Depends: python (>= 2.7~) but it is not installed
                Depends: python:any (>= 2.7.5-5~)
 python-chardet : Depends: python:any (< 2.8)
                  Depends: python:any (>= 2.7.5-5~)
                  Depends: python-pkg-resources but it is not installed
 python-dbus : Depends: python (< 2.8) but it is not installed
               Depends: python (>= 2.7~) but it is not installed
               Depends: python:any (>= 2.7.5-5~)
 python-gi : Depends: python (< 2.8) but it is not installed
             Depends: python (>= 2.7~) but it is not installed
             Depends: python:any (>= 2.7.5-5~)
 python-gobject-2 : Depends: python (< 2.8) but it is not installed
                    Depends: python (>= 2.7~) but it is not installed
                    Depends: python:any (>= 2.7.5-5~)
 python-gtk2 : Depends: python (>= 2.7) but it is not installed
               Depends: python (< 2.8) but it is not installed
 python-html5lib : Depends: python-six but it is not installed
                   Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7.5-5~)
 python-lxml : Depends: python (>= 2.7) but it is not installed
               Depends: python (< 2.8) but it is not installed
 python-pip : Depends: python:any (< 2.8)
              Depends: python:any (>= 2.7.5-5~)
              Recommends: python-all-dev (>= 2.6) but it is not installed
 python-setuptools : Depends: python-pkg-resources (= 20.7.0-1) but it is not installed
                     Depends: python:any (< 2.8)
                     Depends: python:any (>= 2.7.5-5~)
 python-wheel : Depends: python:any (< 2.8)
                Depends: python:any (>= 2.7.5-5~)
 python-xlib : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
 speedtest-cli : Depends: python (>= 2.7) but it is not installed
                 Depends: python (< 2.8) but it is not installed
                 Depends: python-pkg-resources but it is not installed

当我发布时,sudo apt-get -f install我得到:

The following additional packages will be installed:
  python python-dev python-pkg-resources python-six python2.7-dev
Suggested packages:
  python-doc python-tk
The following NEW packages will be installed:
  python python-dev python-pkg-resources python-six python2.7-dev
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
21 not fully installed or removed.
Need to get 0 B/533 kB of archives.
After this operation, 1,465 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.2) ...
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
python2.7: can't open file '/usr/lib/python2.7/py_compile.py': [Errno 2] No such file or directory
dpkg: error processing package python2.7-minimal (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of python-minimal:
 python-minimal depends on python2.7-minimal (>= 2.7.11-1~); however:
  Package python2.7-minimal is not configured yet.

dpkg: error processing package python-minimal (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 python2.7-minimal
 python-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

我现在该怎么办!?我怎样才能修复我毁了的东西!?

16.04
  • 2 2 个回答
  • 9220 Views

2 个回答

  • Voted
  1. user535733
    2017-12-28T06:27:57+08:002017-12-28T06:27:57+08:00

    基本系统服务(如 apt)依赖于 Python,因此您的系统现在很可能已严重损坏。

    你有两个选择:

    • 您可以使用 dpkg 手动重新安装每个 python 包
    • 您可以备份数据并进行全新安装。

    对于熟练的用户来说,第一个选择可能是快速且相当容易的。对于大多数普通用户来说,第二种选择可能更快、更容易。

    • 3
  2. Best Answer
    tgwtdt
    2017-12-28T06:49:23+08:002017-12-28T06:49:23+08:00

    如果您可以访问一些运行良好的 ubuntu VPS,则可以解决此问题:

    apt download python2.7-minimal libpython2.7-stdlib python2.7
    

    然后,您必须使用以下命令将基本文件复制到您自己的系统中:

    sudo scp you@yourserver:/usr/lib/python2.7/*.py /usr/lib/python2.7/
    sudo scp -r you@yourserver:/usr/lib/python2.7/plat-x86_64-linux-gnu /usr/lib/python2.7/
    sudo scp -r you@yourserver:/usr/lib/python2.7/logging /usr/lib/python2.7/
    sudo scp -r you@yourserver:/usr/lib/python2.7/encodings /usr/lib/python2.7/
    

    然后你应该使用 dpkg 来安装 python:

    sudo dpkg -i python2.7-minimal_2.7.12-1ubuntu0~16.04.2_amd64.deb libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.2_amd64.deb python2.7_2.7.12-1ubuntu0~16.04.2_amd64.deb
    

    然后你应该让 apt 自己处理所有事情:

    sudo apt-get install -f
    

    然后您可以验证 apt 是否正常工作:

    sudo apt upgrade
    
    • 1

相关问题

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve