Ubuntu 16.04.7 預設是裝 python 3.5
若額外裝了python 3.6,然後把 /usr/bin/python3指到python 3.6的話
系統在操作的時候如果輸入找不到的指令或是執行檔,總是會吐出下面的錯誤訊息
Traceback (most recent call last): File "/usr/lib/python3.6/dbm/gnu.py", line 4, in <module> from _gdbm import * ModuleNotFoundError: No module named '_gdbm' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 7, in <module> import dbm.gnu as gdbm File "/usr/lib/python3.6/dbm/gnu.py", line 6, in <module> raise ImportError(str(msg) + ', please install the python3-gdbm package') ImportError: No module named '_gdbm', please install the python3-gdbm package During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/command-not-found", line 27, in <module> from CommandNotFound.util import crash_guard File "/usr/lib/python3/dist-packages/CommandNotFound/__init__.py", line 3, in <module> from CommandNotFound.CommandNotFound import CommandNotFound File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 9, in <module> import gdbm ModuleNotFoundError: No module named 'gdbm'
我才發現似乎是因為系統裝了 python3-commandnotfound 這個package,所以找不到command會交給這個package處理,然後python 3.6沒裝gdbm這個套件導致
所以解決方法就是
sudo apt-get install python3.6-gdbm
收工
沒有留言:
張貼留言