zhongpingxu
zhongpingxu

Reputation: 67

python2.7 missing standard dbm module when install by conda

I want to install python2.7 by conda as follows command:

conda create -n tensorflow python=2.7 anaconda

But it is missing of dbm module.

$  python
Python 2.7.15 | packaged by conda-forge | (default, Jul  2 2019, 00:39:44) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named dbm
>>> import Tkinter
>>> 

Then I try to install python-gdbm suggestion by google and stackoverflow.

$ conda install -n tensorflow -c anaconda python-gdbm
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /public/home/miniconda2/envs/tensorflow

  added / updated specs:
    - python-gdbm


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    certifi-2019.11.28         |           py27_0         156 KB  anaconda
    python-gdbm-1.1            |           py27_0          21 KB  anaconda
    ------------------------------------------------------------
                                           Total:         177 KB

The following NEW packages will be INSTALLED:

  gdbm               anaconda/linux-64::gdbm-1.12-0
  python-gdbm        anaconda/linux-64::python-gdbm-1.1-py27_0

The following packages will be UPDATED:

  openssl            conda-forge::openssl-1.1.1d-h516909a_0 --> anaconda::openssl-1.1.1-h7b6447c_0

The following packages will be SUPERSEDED by a higher-priority channel:

  ca-certificates    conda-forge::ca-certificates-2019.11.~ --> anaconda::ca-certificates-2019.11.27-0
  certifi                                       conda-forge --> anaconda


Proceed ([y]/n)? y


Downloading and Extracting Packages
python-gdbm-1.1      | 21 KB     | ################################################################################################################################ | 100% 
certifi-2019.11.28   | 156 KB    | ################################################################################################################################ | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

Unfortunately, I still have the same error when import dbm.

Any help is much appreciated. Thanks.

Upvotes: 2

Views: 665

Answers (1)

merv
merv

Reputation: 77117

AFAIK, there are no Anaconda (or Conda Forge) Python 2.7 builds that support the dbm module for Linux (e.g., see this issue). The anaconda::python-gdbm package should provide the functionality, but the import will be:

import gdbm

Upvotes: 0

Related Questions