ImportError: 没有模块命名 'gdbm', 使用时出现 source ~/. bashrc

嘿,在做一些改变之后 bashrc 我试着用


source ~/.bashrc


但收到以下错误


baaz@FireStorm:~$ source ~/.bashrc
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'


我试图使用安装命令,如错误所示


baaz@FireStorm:~$ sudo apt-get install python3-gdbm
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-gdbm is already the newest version /3.6.5-3~16.04.york0.2/.
python3-gdbm set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


此外,提到了一些决定使用特定于版本的命令,但仍然没有解决方案


baaz@FireStorm:~$ sudo apt-get install python3.5-gdbm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python3.5-gdbm is a virtual package provided by:
python3-gdbm 3.5.1-1 [Not candidate version]

E: Package 'python3.5-gdbm' has no installation candidate


安装命令 pip 给出了以下错误消息


baaz@FireStorm:~$ sudo pip3 install gdbm --upgrade
The directory '/home/baaz/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/baaz/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting gdbm
Could not find a version that satisfies the requirement gdbm /from versions: /
No matching distribution found for gdbm


请提供处理这些错误的方法。
</module></module></module></module></module></module>
已邀请:

窦买办

赞同来自:

你的错误出现,最有可能是因为你的 .bashrc 包含典型的某个地方,所以它被称为 command-not-found, 但 command-not-found, 看起来像最近破碎了。 /如果你直接在你的话语中得到一些废话,你必须得到同样的错误 terminal./


sudo apt install python3-gdbm=3.5.1-1


为我工作。

跑步


dpkg -L python3-gdbm


看起来 gdbm 在我的电脑上安装了一些原因 python3.6, 而不是 python3.5, 但我的Python3版本是 python3.5 /最后一次我检查了这一点 python3.6 有些东西突破了 ubuntu 16.04/.

当他们逃离时你得到的错误


sudo apt-get install python3.5-gdbm


抱怨版本的问题,因此他们注意到的版本的手动安装,工作。

龙天

赞同来自:

它为我工作:


sudo ln -s /usr/lib/python3.6/lib-dynload/_gdbm.cpython-36m-x86_64-linux-gnu.so /usr/lib/python3.5/lib-dynload/_gdbm.cpython-35m-x86_64-linux-gnu.so


注意
35m

在名称链接中。

要回复问题请先登录注册