我正在尝试在我的环境中安装 python3(和 python2),但我不断遇到以下问题:
sudo apt-get install python3
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3 is already the newest version (3.10.6-1~22.04).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 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 python3-minimal (3.10.6-1~22.04) ...
/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
Setting up language-selector-gnome (0.219) ...
/var/lib/dpkg/info/language-selector-gnome.postinst: 6: py3compile: not found
dpkg: error processing package language-selector-gnome (--configure):
installed language-selector-gnome package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
python3-minimal
language-selector-gnome
E: Sub-process /usr/bin/dpkg returned an error code (1)
我尝试以不同的方式解决问题,但每次都遇到同样的问题。谢谢你的帮助。
编辑:我运行了命令
sudo apt remove python3
试图删除 python3,我得到以下错误:
The following NEW packages will be installed:
libqt5gui5-gles libqt5quick5-gles
0 upgraded, 2 newly installed, 217 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 0 B/5,427 kB of archives.
After this operation, 276 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 261970 files and directories currently installed.)
Removing language-selector-gnome (0.219) ...
/var/lib/dpkg/info/language-selector-gnome.prerm: 6: py3clean: not found
dpkg: error processing package language-selector-gnome (--remove):
installed language-selector-gnome package pre-removal script subprocess returne
d error exit status 127
/var/lib/dpkg/info/language-selector-gnome.postinst: 6: py3compile: not found
dpkg: error while cleaning up:
installed language-selector-gnome package post-installation script subprocess r
eturned error exit status 127
Removing python3-commandnotfound (22.04.0) ...
/var/lib/dpkg/info/python3-commandnotfound.prerm: 6: py3clean: not found
dpkg: error processing package python3-commandnotfound (--remove):
installed python3-commandnotfound package pre-removal script subprocess returne
d error exit status 127
dpkg: too many errors, stopping
Errors were encountered while processing:
language-selector-gnome
python3-commandnotfound
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
编辑 2:尝试通过以下方式安装 python3.10-minimal:
sudo apt-get install python3.10-minimal
并得到以下错误:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3.10-minimal is already the newest version (3.10.6-1~22.04.2).
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 python3-commandnotfound (22.04.0) ...
/var/lib/dpkg/info/python3-commandnotfound.postinst: 6: py3compile: not found
dpkg: error processing package python3-commandnotfound (--configure):
installed python3-commandnotfound package post-installation script subprocess returned error exit status 127
Setting up python3-minimal (3.10.6-1~22.04) ...
/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
Setting up language-selector-gnome (0.219) ...
/var/lib/dpkg/info/language-selector-gnome.postinst: 6: py3compile: not found
dpkg: error processing package language-selector-gnome (--configure):
installed language-selector-gnome package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
python3-commandnotfound
python3-minimal
language-selector-gnome
E: Sub-process /usr/bin/dpkg returned an error code (1)