py3compile: not found 问题解决

本文详细记录了在Ubuntu16.04环境下安装wine过程中遇到的py3compile:notfound问题及其解决方法。问题根源在于python版本不一致,通过重新安装匹配版本的python并正确配置软链,最终成功解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、解决方法

在ubuntu16.04上安装wine的过程中发现apt-add-repository有问题,网上查资料后发现需要安装python-software-properties和software-properties-common,于是用apt-get install安装。

期间遇到了这样一个问题py3compile: not found,经过搜索发现py3compile是属于python3-minimal包的,然后下载python3-minimal_3.5.1-3_amd64.deb手动进行安装,下载地址如下。

https://mirrors.edge.kernel.org/ubuntu/pool/main/p/python3-defaults/ 

安装命令如下

sudo dpkg -i python3-minimal_3.5.1-3_amd64.deb

到这一步应该问题就解决了,如果还没解决,可能就是下面的情况。

2、python版本导致的问题

安装过程中出现了下面的问题,令我十分困惑,py3compile是属于python3-minimal包的,那么安装python3-minimal的过程怎么会依赖于py3compile呢?

xxx@xxx:~/duan/package/deb$ sudo dpkg --configure python3-minimal
正在设置 python3-minimal (3.5.1-3) ...
/var/lib/dpkg/info/python3-minimal.postinst: 5: /var/lib/dpkg/info/python3-minimal.postinst: py3compile: not found
dpkg: 处理软件包 python3-minimal (--configure)时出错:
 子进程 已安装 post-installation 脚本 返回错误状态 127
在处理时有错误发生:

实际上经过分析发现python3-minimal_3.5.1-3_amd64.deb里的3.5.1-3对应着python3.5,安装python3-minimal的时候会自动重建/usr/bin/python3链接到python3.5,如果系统中没有安装python3.5的话就会出问题,ubuntu16.04安装时自带python3.5.2,但是我卸载了,然后装了python3.6.6,问题就出在这版本不一致上。

然后我重新安装了python3.5.2,并且建立了一个软链/usr/bin/python3.5,然后重新安装python3-minimal_3.5.1-3_amd64.deb就好了。

sudo apt-get install python3-pip 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 python3-pip 已经是最新版 (18.1-5.1.lnd.1)。 升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 30 个软件包未被升级。 有 6 个软件包没有被完全安装或卸载。 解压缩后会消耗 0 B 的额外空间。 您希望继续执行吗? [Y/n] y dpkg: 警告: 正在解析文件 '/var/lib/dpkg/status' 第 3582 行附近,软件包 'create.license' : missing 'Description' field 正在设置 devscripts (2.19.5+deb10u1+nmu1) ... /var/lib/dpkg/info/devscripts.postinst: 12: /var/lib/dpkg/info/devscripts.postinst: py3compile: not found dpkg: 处理软件包 devscripts (--configure)时出错: 已安装 devscripts 软件包 post-installation 脚本 子进程返回错误状态 127 正在设置 python3-gpg (1.12.0-6.lnd.2) ... /var/lib/dpkg/info/python3-gpg.postinst: 6: /var/lib/dpkg/info/python3-gpg.postinst: py3compile: not found dpkg: 处理软件包 python3-gpg (--configure)时出错: 已安装 python3-gpg 软件包 post-installation 脚本 子进程返回错误状态 127 正在设置 python3-debian (0.1.35+nmu1) ... /var/lib/dpkg/info/python3-debian.postinst: 6: /var/lib/dpkg/info/python3-debian.postinst: py3compile: not found dpkg: 处理软件包 python3-debian (--configure)时出错: 已安装 python3-debian 软件包 post-installation 脚本 子进程返回错误状态 127 正在设置 python3-unidiff (0.5.4-1.1) ... /var/lib/dpkg/info/python3-unidiff.postinst: 6: /var/lib/dpkg/info/python3-unidiff.postinst: py3compile: not found dpkg: 处理软件包 python3-unidiff (--configure)时出错: 已安装 python3-unidiff 软件包 post-installation 脚本 子进程返回错误状态 127 正在设置 python3-magic (2:0.4.15-2.1) ... /var/lib/dpkg/info/python3-magic.postinst: 6: /var/lib/dpkg/info/python3-magic.postinst: py3compile: not found dpkg: 处理软件包 python3-magic (--configure)时出错: 已安装 python3-magic 软件包 post-installation 脚本 子进程返回错误状态 127 dpkg: 依赖关系问题使得 dput 的配置工作不能继续: dput 依赖于 python3-debian;然而: 软件包 python3-debian 尚未配置。 dput 依赖于 python3-gpg;然而: 软件包 python3-gpg 尚未配置。 dpkg: 处理软件包 dput (--configure)时出错: 依赖关系问题 - 仍未被配置 在处理时有错误发生: devscripts python3-gpg python3-debian python3-unidiff python3-magic dput E: Sub-process /usr/bin/dpkg returned an error code (1)
03-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值