簡體   English   中英

在終端中找不到命令時出現Linux python錯誤

[英]Linux python error when command in terminal not found

我正在運行Linux Mint 18.3,內核為4.13.0-39-generic。 每次我在無效的終端中運行命令或未安裝程序時,都會得到python錯誤的堆棧跟蹤

Traceback (most recent call last):
  File "/usr/lib/python3.5/dbm/gnu.py", line 4, in <module>
    from _gdbm import *
ImportError: 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.5/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
ImportError: No module named 'gdbm'

要回答第一個問題,請安裝gdbm:

ii  libgdbm3:amd64                            1.8.3-13.1                                   amd64        GNU dbm database routines (runtime version)
ii  python-gdbm                              2.7.12-1~16.04                            amd64        GNU dbm database support for Python
ii  python3-gdbm:amd64                        3.6.5-3~16.04.york0.2                     amd64       GNU dbm database support for Python 3.x

正如您在錯誤消息中看到的那樣,您缺少模塊“ gdbm”,如此處所示:

sudo apt-get install python3.5-gdbm

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM