首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Ubuntu20.04 /var/lib/dpkg/info/software-properties-common.postinst: 6: py3compile:未找到

Ubuntu20.04 /var/lib/dpkg/info/software-properties-common.postinst: 6: py3compile:未找到
EN

Ask Ubuntu用户
提问于 2022-07-01 06:48:00
回答 2查看 1.2K关注 0票数 1

当我试图通过运行以下命令进行升级时:

代码语言:javascript
运行
复制
sudo apt-get upgrade

我得到一个错误,输出如下:

代码语言:javascript
运行
复制
Reading package lists... Done

Building dependency tree  
     
Reading state information... Done

Calculating upgrade... Done

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

3 not fully installed or removed.

After this operation, 0 B of additional disk space will be used.

Do you want to continue? [Y/n] y

Setting up software-properties-common (0.99.9.8) ...

/var/lib/dpkg/info/software-properties-common.postinst: 6:
py3compile: not found

dpkg: error processing package software-properties-common (--configure):

 installed software-properties-common package post-installation script subprocess returned error exit status 127
Setting up python3-minimal (3.8.2-0ubuntu2) ...

/var/lib/dpkg/info/python3-minimal.postinst: 5: py3compile: not found
dpkg: error processing package python3-minimal (--configure):
 installed python3-minimal package post-installation script subprocess returned error exit status 127

dpkg: dependency problems prevent configuration of software-properties-gtk:
 software-properties-gtk depends on software-properties-common; however:
  Package software-properties-common is not configured yet.

dpkg: error processing package software-properties-gtk (--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:
 software-properties-common
 python3-minimal
 software-properties-gtk
E: Sub-process /usr/bin/dpkg returned an error code (1)

which python python3的输出是:

代码语言:javascript
运行
复制
/usr/bin/python

ls -l /usr/bin/python*的输出是:

代码语言:javascript
运行
复制
lrwxrwxrwx 1 root root       7 Apr 15  2020 /usr/bin/python -> python2

lrwxrwxrwx 1 root root       9 Mar 13  2020 /usr/bin/python2 -> python2.7

-rwxr-xr-x 1 root root 3674216 Mar  8  2021 /usr/bin/python2.7
lrwxrwxrwx 1 root root       9 Jul  1 10:56 /usr/bin/python3 -> python3.8

lrwxrwxrwx 1 root root      33 Mar 15 17:52 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config

lrwxrwxrwx 1 root root      16 Mar 13  2020 /usr/bin/python3-config -> python3.8-config

sudo apt install python-is-python3的输出是:

代码语言:javascript
运行
复制
Package python-is-python3 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: python-is-python2
E: Package 'python-is-python3' has no installation candidate

然后,我按照步骤在这个答案中恢复到原始存储库,并再次运行sudo apt install python-is-python3,它提供了以下输出:

代码语言:javascript
运行
复制
Reading package lists... Done

Building dependency tree    
   
Reading state information... Done

The following packages were automatically installed and are no longer required:

  libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib linux-headers-5.13.0-48-generic linux-hwe-5.13-headers-5.13.0-48 linux-image-5.13.0-48-generic linux-modules-5.13.0-48-generic
  linux-modules-extra-5.13.0-48-generic python2 python2-minimal python2.7 python2.7-minimal

Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  ubuntu-advantage-tools
The following packages will be REMOVED:
  python-is-python2
The following NEW packages will be installed:
  python-is-python3

The following packages will be upgraded:
  ubuntu-advantage-tools

1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.

4 not fully installed or removed.

Need to get 879 kB of archives.

After this operation, 21.5 kB of additional disk space will be used.

Do you want to continue? [Y/n] y

Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 ubuntu-advantage-tools amd64 27.9~20.04.1 [876 kB]

Get:2 http://archive.ubuntu.com/ubuntu foca
l/main amd64 python-is-python3 all 3.8.2-4 [2,364 B]

Fetched 879 kB in 2s (361 kB/s)       
        
Preconfiguring packages ...
dpkg: warning: files list file for package 'python3-commandnotfound' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'apturl-common' missing; assuming package has no files currently installed
(Reading database ... 220697 files and directories currently installed.)
Preparing to unpack .../ubuntu-advantage-tools_27.9~20.04.1_amd64.deb ...

/var/lib/dpkg/info/ubuntu-advantage-tools.prerm: 48: py3clean: not found...................................................................................................................................................] 
dpkg: warning: old ubuntu-advantage-tools package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
Failed to stop ubuntu-advantage.service: Unit ubuntu-advantage.service not loaded.
/var/lib/dpkg/tmp.ci/prerm: 48: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/ubuntu-advantage-tools_27.9~20.04.1_amd64.deb (--unpack):
 new ubuntu-advantage-tools package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/ubuntu-advantage-tools.postinst: 451: py3compile: not found
dpkg: error while cleaning up:
 installed ubuntu-advantage-tools package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 /var/cache/apt/archives/ubuntu-advantage-tools_27.9~20.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
prajesh@revyz-113:~$ sudo apt autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  ubuntu-advantage-tools
The following packages will be REMOVED:
  linux-headers-5.13.0-48-generic linux-hwe-5.13-headers-5.13.0-48 linux-image-5.13.0-48-generic linux-modules-5.13.0-48-generic linux-modules-extra-5.13.0-48-generic
The following packages will be upgraded:
  ubuntu-advantage-tools
1 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
4 not fully installed or removed.
Need to get 0 B/876 kB of archives.
After this operation, 508 MB disk space will be freed.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
dpkg: warning: files list file for package 'python3-commandnotfound' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'apturl-common' missing; assuming package has no files currently installed
(Reading database ... 220697 files and directories currently installed.)
Preparing to unpack .../ubuntu-advantage-tools_27.9~20.04.1_amd64.deb ...

/var/lib/dpkg/info/ubuntu-advantage-tools.prerm: 48: py3clean: not found...................................................................................................................................................] 
dpkg: warning: old ubuntu-advantage-tools package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
Failed to stop ubuntu-advantage.service: Unit ubuntu-advantage.service not loaded.
/var/lib/dpkg/tmp.ci/prerm: 48: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/ubuntu-advantage-tools_27.9~20.04.1_amd64.deb (--unpack):
 new ubuntu-advantage-tools package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/ubuntu-advantage-tools.postinst: 451: py3compile: not found
dpkg: error while cleaning up:
 installed ubuntu-advantage-tools package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 /var/cache/apt/archives/ubuntu-advantage-tools_27.9~20.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
EN

回答 2

Ask Ubuntu用户

回答已采纳

发布于 2022-07-01 15:44:03

当前的安装存在一些非常严重的问题:

  • apt-get upgrade命令输出中的错误是由于您的系统上的python安装失败造成的.您用默认的python3安装做了一些事情,使它变得非功能性。
  • 指向python3.8的符号链接存在于/usr/bin中,但是二进制本身,即/usr/bin/python3.8丢失了(可能删除了二进制,甚至完全删除了python3.8 )。
  • apt install python-is-python3命令输出中的错误表明您已经修改了/etc/apt/sources.list并添加了来自不同版本/版本的混合源,这是完全不建议的,应该避免。

虽然您可以很容易地按照这个答案中的步骤修复源列表,但Python3安装在您的系统上似乎受到了严重损坏.虽然高级用户可能能够修复它(即使这样的过程是冗长的和容易出错的),但是一个普通的用户不能. python3对于Ubuntu20.04是至关重要的,没有它几乎什么都不能正常运行。请参阅这个答案获取详细信息。

在你的情况下,重新安装是最简单的正确决定.我建议您备份数据,然后重新安装Ubuntu,不要再使用python了。

票数 1
EN

Ask Ubuntu用户

发布于 2022-11-03 14:09:59

不确定我是否处于相同的困境中,但以下命令(在这个答案中找到)只是修复了我的py3compile: not found错误:

代码语言:javascript
运行
复制
sudo apt install -f --reinstall python3-minimal
票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1416715

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档