【问题标题】:python2.7 missing standard dbm module when install by conda由 conda 安装时 python2.7 缺少标准 dbm 模块
【发布时间】:2020-01-03 12:31:31
【问题描述】:

我想通过conda安装python2.7,命令如下:

conda create -n tensorflow python=2.7 anaconda

但它缺少dbm 模块。

$  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
>>> 

然后我尝试安装 google 和 stackoverflow 的 python-gdbm 建议。

$ 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

不幸的是,我在import dbm时仍然有同样的错误。

非常感谢任何帮助。 谢谢。

【问题讨论】:

    标签: python-2.7 tensorflow conda dbm


    【解决方案1】:

    AFAIK,没有 Anaconda(或 Conda Forge)Python 2.7 版本支持 Linux 的 dbm 模块(例如,请参阅 this issue)。 anaconda::python-gdbm 包应该提供功能,但导入将是:

    import gdbm
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-05-09
      • 1970-01-01
      • 1970-01-01
      • 2016-06-04
      • 2012-05-12
      • 2014-03-26
      • 1970-01-01
      相关资源
      最近更新 更多