背景:在拿到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
總結:在刪除系統的東西前先思考一下,千萬別手賤!!!