繁体   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