在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