python-dev 安装导致“E: 子进程 /usr/bin/dpkg 返回错误代码 (1)”

python-dev 安装导致“E: 子进程 /usr/bin/dpkg 返回错误代码 (1)”

我遇到了这些缺陷,并且我尝试了所有方法,但仍然出现这些错误。

# apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libpython-all-dev libpython-dev libpython-stdlib libpython2-dev libpython2-stdlib python python-minimal python2 python2-dev python2-minimal
Suggested packages:
  python-doc python2-doc
The following NEW packages will be installed:
  libpython2-dev libpython2-stdlib python2 python2-dev python2-minimal
The following packages will be upgraded:
  libpython-all-dev libpython-dev libpython-stdlib python python-minimal
5 upgraded, 5 newly installed, 0 to remove and 1960 not upgraded.
3 not fully installed or removed.
Need to get 0 B/212 kB of archives.
After this operation, 311 kB disk space will be freed.
Do you want to continue? [Y/n] y
Reading changelogs... Done
(Reading database ... 373142 files and directories currently installed.)
Preparing to unpack .../python-minimal_2.7.15-3_amd64.deb ...
/var/lib/dpkg/info/python-minimal.prerm: 4: /var/lib/dpkg/info/python-minimal.prerm: find: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
dpkg: error processing archive /var/cache/apt/archives/python-minimal_2.7.15-3_amd64.deb (--unpack):
 there is no script in the new version of the package - giving up
dpkg: considering deconfiguration of python-minimal, which would be broken by installation of python2-minimal ...
dpkg: yes, will deconfigure python-minimal (broken by python2-minimal)
Preparing to unpack .../python2-minimal_2.7.15-3_amd64.deb ...
De-configuring python-minimal (2.7.13-2) ...
/var/lib/dpkg/info/python-minimal.prerm: 4: /var/lib/dpkg/info/python-minimal.prerm: find: not found
dpkg: error processing archive /var/cache/apt/archives/python2-minimal_2.7.15-3_amd64.deb (--unpack):
 subprocess installed pre-removal script returned error exit status 127
Errors were encountered while processing:
 /var/cache/apt/archives/python-minimal_2.7.15-3_amd64.deb
 /var/cache/apt/archives/python2-minimal_2.7.15-3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)



root@LYNIX:~# dpkg --configure -a
dpkg: dependency problems prevent configuration of python-dev:
 python-dev depends on python (= 2.7.15-3); however:
  Version of python on system is 2.7.13-2.
 python-dev depends on libpython-dev (= 2.7.15-3); however:
  Version of libpython-dev:amd64 on system is 2.7.13-2.
 python-dev depends on python2-dev (= 2.7.15-3); however:
  Package python2-dev is not installed.

dpkg: error processing package python-dev (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-all-dev:
 python-all-dev depends on python (= 2.7.15-3); however:
  Version of python on system is 2.7.13-2.
 python-all-dev depends on libpython-all-dev (= 2.7.15-3); however:
  Version of libpython-all-dev:amd64 on system is 2.7.13-2.
 python-all-dev depends on python-dev (= 2.7.15-3); however:
  Package python-dev is not configured yet.

dpkg: error processing package python-all-dev (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-all:
 python-all depends on python (= 2.7.15-3); however:
  Version of python on system is 2.7.13-2.

dpkg: error processing package python-all (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python-dev
 python-all-dev
 python-all

有人知道如何解决这个问题吗?

答案1

是的,这就是我所做的:

walt@bat:~(0)$ less /var/lib/dpkg/info/python-minimal.prerm
#! /bin/sh
set -e

find /usr/share/python/ -name '*.py[oc]' -delete

walt@bat:~(0)$ type -a find
find is /usr/bin/find
walt@bat:~(0)$ 

这意味着尝试通过查看来/var/lib/dpkg/info/python-minimal.prerm使用该实用程序。但它不在那里。 find$PATH

但是,find/usr/bin/find,所以/usr/bin不在您的中$PATH

检查你的启动文件(~/.bashrc阅读man bash,“INVOCATION”部分)以了解你设置的位置PATH=

$PATH这是适用于的一部分root

export PATH=/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

这应该可以让你开始,但不会包含你所有的自定义内容。

相关内容