linux版python升级依赖项问题

介绍

linux中python2升级到python3,会出现一系列的依赖项未配置问题,如果不解决,将会影响其他环境的安装配置。

比如python2升级到3之后,安装docker就会出现(大量文字高能警告,可以忽略跳到后面)

正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 python-pkg-resources 已经是最新版 (33.1.1-1)。 python-pkg-resources 已设置为手动安装。 升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 1 个软件包未被升级。 有 15 个软件包没有被完全安装或卸载。 解压缩后会消耗 0 B 的额外空间。 您希望继续执行吗? [Y/n] y 正在设置 python-idna (2.2-1) ... /var/lib/dpkg/info/python-idna.postinst: /usr/bin/pycompile: /usr/bin/python: 解释器错误: 没有那个文件或目录 dpkg: 处理软件包 python-idna (--configure)时出错: 子进程 已安装 post-installation 脚本 返回错误状态 126 正在设置 python-pyasn1 (0.1.9-2) ... /var/lib/dpkg/info/python-pyasn1.postinst: /usr/bin/pycompile: /usr/bin/python: 解释器错误: 没有那个文件或目录 dpkg: 处理软件包 python-pyasn1 (--configure)时出错: 子进程 已安装 post-installation 脚本 返回错误状态 126 正在设置 python-wheel (0.29.0-2) ... /var/lib/dpkg/info/python-wheel.postinst: /usr/bin/pycompile: /usr/bin/python: 解释器错误: 没有那个文件或目录 dpkg: 处理软件包 python-wheel (--configure)时出错: 子进程 已安装 post-installation 脚本 返回错误状态 126 正在设置 python-pkg-resources (33.1.1-1) ... /var/lib/dpkg/info/python-pkg-resources.postinst: /usr/bin/pycompile: /usr/bin/python: 解释器错误: 没有那个文件或目录 dpkg: 处理软件包 python-pkg-resources (--configure)时出错: 子进程 已安装 post-installation 脚本 返回错误状态 126 正在设置 python-keyrings.alt (1.3-1) ... /var/lib/dpkg/info/python-keyrings.alt.postinst: /usr/bin/pycompile: /usr/bin/python: 解释器错误: 没有那个文件或目录 dpkg: 处理软件包 python-keyrings.alt (--configure)时出错: 子进程 已安装 post-installation 脚本 返回错误状态 126 正在设置 python-six (1.10.0-3) ... /var/lib/dpkg/info/python-six.postinst: /usr/bin/pycompile: /usr/bin/python: 解释器错误: 没有那个文件或目录 dpkg: 处理软件包 python-six (--configure)时出错: 子进程 已安装 post-installation 脚本 返回错误状态 126 正在设置 python-enum34 (1.1.6-1) ... /var/lib/dpkg/info/python-enum34.postinst: /usr/bin/pycompile: /usr/bin/python: 解释器错误: 没有那个文件或目录 dpkg: 处理软件包 python-enum34 (--configure)时出错: 子进程 已安装 post-installation 脚本 返回错误状态 126 dpkg: 依赖关系问题使得 python-cryptography 的配置工作不能继续: python-cryptography 依赖于 python-enum34;然而: 软件包 python-enum34 尚未配置。 python-cryptography 依赖于 python-idna (>= 2.0);然而: 软件包 python-idna 尚未配置。 python-cryptography 依赖于 python-pyasn1 (>= 0.1.8);然而: 软件包 python-pyasn1 尚未配置。 python-cryptograp

解决办法:

sudo apt-get clean
sudo apt-get update
sudo apt-get install --reinstall python-minimal python-lockfile

(某些情况下只执行最后一行命令也许)

参考资料

Ubuntu下报错:处理软件包 python-dnspython (--configure)时出错 解决方法

原文地址:https://www.cnblogs.com/MemoryDrive/p/13296980.html