由于安装的软件包太新而未满足依赖关系

由于安装的软件包太新而未满足依赖关系

当我尝试apt-get upgrade(是的,我首先进行了更新)时,我得到以下信息:

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:
 python-samba : Depends: libwbclient0 (= 2:4.5.12+dfsg-2+deb9u2) but 2:4.5.12+dfsg-2+deb9u3 is installed
                Depends: samba-libs (= 2:4.5.12+dfsg-2+deb9u2) but 2:4.5.12+dfsg-2+deb9u3 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

所以罪魁祸首似乎是libwbclient0subversion 中需要的deb9u2但显然安装在deb9u3.当我尝试--fix-broken按照apt-get删除脚本的建议运行时,似乎由于缺少包而崩溃maketransConfigParser

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  python-samba
Suggested packages:
  python-gpgme
The following packages will be upgraded:
  python-samba
1 upgraded, 0 newly installed, 0 to remove and 91 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1,364 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Reading changelogs... Done
(Reading database ... 567338 files and directories currently installed.)
Preparing to unpack .../python-samba_2%3a4.5.12+dfsg-2+deb9u3_amd64.deb ...
Traceback (most recent call last):
  File "/usr/bin/pyclean", line 32, in <module>
    from debpython.namespace import add_namespace_files
  File "/usr/share/python/debpython/namespace.py", line 28, in <module>
    from debpython.pydist import PUBLIC_DIR_RE
  File "/usr/share/python/debpython/pydist.py", line 27, in <module>
    from string import maketrans
ImportError: cannot import name 'maketrans'
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
Traceback (most recent call last):
  File "/usr/bin/pyclean", line 32, in <module>
    from debpython.namespace import add_namespace_files
  File "/usr/share/python/debpython/namespace.py", line 28, in <module>
    from debpython.pydist import PUBLIC_DIR_RE
  File "/usr/share/python/debpython/pydist.py", line 27, in <module>
    from string import maketrans
ImportError: cannot import name 'maketrans'
dpkg: error processing archive /var/cache/apt/archives/python-samba_2%3a4.5.12+dfsg-2+deb9u3_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/python-samba_2%3a4.5.12+dfsg-2+deb9u3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我使用的是 Debian Stretch 9.4 内核: Linux 3.10-2-amd64 #1 SMP Debian 3.10.7-1

在我自己的尝试失败并且在网上找不到任何解决此问题的信息后,我询问aptitudesynaptic尝试一下。两人都尝试过一些事情,但都失败了。

我什至不需要 samba,所以摆脱它就好了,但apt在我不修复损坏的包之前不想删除任何东西:

 package is in a very bad inconsistent state; you should
 reinstall it before attempting a removal

答案1

ImportError: cannot import name 'maketrans'

maketrans是一个 Python 3 错误,它是由于尝试像在 Python 2 代码中那样进行导入而导致的。这意味着/usr/bin/python你的系统中有一个Python 3解释器;这破坏了 Debian 衍生品。

要解决此问题,假设python2.7仍然安装,您需要修复/usr/bin/python符号链接,使其指向/usr/bin/python2.7

sudo ln -s python2.7 /usr/bin/python

相关内容