在ubuntu16.04中输入不存在shell命令时,报错ModuleNotFoundError的解决方案


背景:在拿到ubuntu机器后,我在系统上安装了python的3.7版本,在安装过程中删除了一个lsb_release.py文件,之后我的shell命令就使用异常了。

报错触发原因

当我输入ubuntu无法识别的命令的时候,正常来说应该提示类似于 command not found 之类的字眼,但是系统确报了如下错误:

报错详情:

Traceback (most recent call last):
  File "/usr/lib/command-not-found", line 27, in <module>
    from CommandNotFound.util import crash_guard
ModuleNotFoundError: No module named 'CommandNotFound'

解决方案:

sudo apt-get remove --purge python3*
sudo apt auto remove

参考链接:https://askubuntu.com/questions/766246/missing-package-commandnotfound

总结:在删除系统的东西前先思考一下,千万别手贱!!!


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM