记录python多版本导致的一个问题

最近在ikoula的vps安装了很多版本的python,删除了几个后,在安装需要python的软件时报以下错误

root@frhb54182flex:~# apt-get install nmap
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nmap is already the newest version (7.40-1).
The following package was automatically installed and is no longer required:
  libgnutls-openssl27
Use 'apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
6 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 python-chardet (2.3.0-2) ...
/var/lib/dpkg/info/python-chardet.postinst: /usr/bin/pycompile: /usr/bin/python: bad interpreter: No such file or directory
dpkg: error processing package python-chardet (--configure):
 subprocess installed post-installation script returned error exit status 126
Setting up python-bs4 (4.5.3-1) ...
/var/lib/dpkg/info/python-bs4.postinst: /usr/bin/pycompile: /usr/bin/python: bad interpreter: No such file or directory
dpkg: error processing package python-bs4 (--configure):
 subprocess installed post-installation script returned error exit status 126
Setting up python-lxml (3.7.1-1+deb9u3) ...
/var/lib/dpkg/info/python-lxml.postinst: /usr/bin/pycompile: /usr/bin/python: bad interpreter: No such file or directory
dpkg: error processing package python-lxml (--configure):
 subprocess installed post-installation script returned error exit status 126
Setting up python-webencodings (0.5-2) ...
/var/lib/dpkg/info/python-webencodings.postinst: /usr/bin/pycompile: /usr/bin/python: bad interpreter: No such file or directory
dpkg: error processing package python-webencodings (--configure):
 subprocess installed post-installation script returned error exit status 126
dpkg: dependency problems prevent configuration of ndiff:
 ndiff depends on python-lxml; however:
  Package python-lxml is not configured yet.

dpkg: error processing package ndiff (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-html5lib:
 python-html5lib depends on python-webencodings; however:
  Package python-webencodings is not configured yet.

dpkg: error processing package python-html5lib (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python-chardet
 python-bs4
 python-lxml
 python-webencodings
 ndiff
 python-html5lib
E: Sub-process /usr/bin/dpkg returned an error code (1)

执行一下康康python的版本

root@frhb54182flex:~# python3 --version
Python 3.8.3
root@frhb54182flex:~# python --version
-bash: python: command not found

这应该是没有指定python默认版本,ls软链接也试过了,没有解决。

查阅了一下资料,执行sudo apt-get install --reinstall python-minimal python-lockfile后恢复正常


root@frhb54182flex:~# sudo apt-get install --reinstall python-minimal python-lockfile
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  python-lockfile-doc
The following NEW packages will be installed:
  python-lockfile
0 upgraded, 1 newly installed, 1 reinstalled, 0 to remove and 1 not upgraded.
6 not fully installed or removed.
Need to get 57.6 kB of archives.
After this operation, 68.6 kB of additional disk space will be used.
Get:1 http://mirror.debian.ikoula.com/debian stretch/main amd64 python-minimal amd64 2.7.13-2 [40.5 kB]
Get:2 http://mirror.debian.ikoula.com/debian stretch/main amd64 python-lockfile all 1:0.12.2-2 [17.0 kB]
Fetched 57.6 kB in 0s (1,538 kB/s)          
(Reading database ... 80254 files and directories currently installed.)
Preparing to unpack .../python-minimal_2.7.13-2_amd64.deb ...
Unpacking python-minimal (2.7.13-2) over (2.7.13-2) ...
Selecting previously unselected package python-lockfile.
Preparing to unpack .../python-lockfile_1%3a0.12.2-2_all.deb ...
Unpacking python-lockfile (1:0.12.2-2) ...
Setting up python-chardet (2.3.0-2) ...
Setting up python-minimal (2.7.13-2) ...
Setting up python-bs4 (4.5.3-1) ...
Setting up python-lxml (3.7.1-1+deb9u3) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up python-lockfile (1:0.12.2-2) ...
Setting up python-webencodings (0.5-2) ...
Setting up ndiff (7.40-1) ...
Setting up python-html5lib (0.999999999-1) ...
W: APT had planned for dpkg to do more than it reported back (16 vs 29).
   Affected packages: python-bs4:amd64 python-chardet:amd64 python-lxml:amd64 python-webencodings:amd64
root@frhb54182flex:~# apt-get install nmapReading package lists... Done
Building dependency tree       
Reading state information... Done
nmap is already the newest version (7.40-1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

root@frhb54182flex:~# nmap wangfuchao.com

Starting Nmap 7.40 ( https://nmap.org ) at 2021-01-29 12:51 CET
Stats: 0:00:02 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 1.15% done; ETC: 12:54 (0:02:52 remaining)
Stats: 0:00:04 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 3.95% done; ETC: 12:52 (0:01:13 remaining)
Stats: 0:00:04 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 6.15% done; ETC: 12:52 (0:01:01 remaining)
Stats: 0:00:05 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 7.90% done; ETC: 12:52 (0:00:58 remaining)
Stats: 0:00:30 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 24.30% done; ETC: 12:53 (0:01:33 remaining)

root@frhb54182flex:~# 

https://askubuntu.com/questions/534040/dpkg-reports-problems-configuring-huge-list-of-python-related-packages-after-any

© 版权声明
THE END
喜欢就支持以下吧
点赞0赞赏 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容