In the Python 3 docs, it states that the dbm module will use gdbm if it's installed. In my script I use from dbm.gnu import open as dbm_open
to try and import the module. It always returns with the exception ImportError: No module named '_gdbm'
. I've gone to the gnu website and have downloaded the latest version. I installed it using
./configure --enable-libgdbm-compat
, make; make check; make install
, and it installed with no errors. I can access the man page for the library but I still can't import it into Python 3.5.2 (Anaconda). How do I install the Python module for gdbm?
Asked
Active
Viewed 3,192 times
5

Tankobot
- 1,492
- 14
- 21
-
Possible duplicate of [GDBM doesn't work with Python 3.6 and anaconda](https://stackoverflow.com/questions/49113718/gdbm-doesnt-work-with-python-3-6-and-anaconda) – gerrit Jul 02 '18 at 17:59
1 Answers
0
I got similar issue though I am not sure which platform you are using.
Steps are:
- look for file _gdbm.cpython-"python version"-.so example file: _gdbm.cpython-39-darwin.so
- Once you find the path check which python version in directory path.
- Try creating same python venv.
- Execute your code.
Before this make sure you have install appropriate gdbm version installed on host machine, for mac it's different for ubuntu it's different name.