Porównaj ceny domen i usług IT, sprzedawców z całego świata

ImportError: Żaden moduł o nazwie `` gdbm '' nie został zgłoszony podczas korzystania ze źródła ~/. bashrc


Hej po wprowadzeniu kilku zmian w bashrc próbowałem użyć
source ~/.bashrc

ale otrzymałem następujący błąd
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 packageDuring 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'

Próbowałem użyć poleceń instalacji, jak podano w błędzie
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.

Wspomniano również, że niektóre rozwiązania używają poleceń specyficznych dla wersji, ale jak dotąd nie otrzymały żadnego rozwiązania
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

Polecenie pip install zwróciło następujący komunikat o błędzie
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

Zaproponuj sposób radzenia sobie z tymi błędami.
Zaproszony:
Anonimowy użytkownik

Anonimowy użytkownik

Potwierdzenie od:

Twój błąd jest najprawdopodobniej spowodowany tym, że plik .bashrc zawiera gdzieś literówkę, więc wywoływana jest komenda-not-found, ale wydaje się, że polecenie-not-found zostało ostatnio uszkodzone. (Powinieneś otrzymać ten sam błąd, jeśli wpiszesz jakieś bzdury bezpośrednio do terminala.)
sudo apt install python3-gdbm=3.5.1-1

pracował dla mnie.
Od biegania
dpkg -L python3-gdbm

wygląda na to, że gdbm na moim komputerze jest zainstalowany na python3.6, a nie python3.5 z jakiegoś powodu, ale moja wersja python3 to python3.5 (a ostatnio sprawdziłem, że python3.6 coś psuje w systemie Ubuntu 16.04).
Błąd, który wystąpił podczas uruchamiania
sudo apt-get install python3.5-gdbm

skarżył się na problem z wersją, więc ręczne zainstalowanie wersji, którą zauważyli, zadziałało.
Anonimowy użytkownik

Anonimowy użytkownik

Potwierdzenie od:

To zadziałało dla mnie:
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

Zwróć uwagę na
35m
w tytule linku.

Aby odpowiedzieć na pytania, Zaloguj się lub Zarejestruj się