python-2.7 - 由 conda 安装时 python2.7 缺少标准 dbm 模块
问题描述
我想通过 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
>>>
然后我尝试安装python-gdbm
google和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
不幸的是,当import dbm
.
任何帮助深表感谢。谢谢。
解决方案
AFAIK,没有支持dbm
Linux 模块的 Anaconda(或 Conda Forge)Python 2.7 构建(例如,请参阅此问题)。该anaconda::python-gdbm
包应提供功能,但导入将是:
import gdbm
推荐阅读
- android-studio - 如何将捕获的图像传递给图像视图
- google-apps-script - 根据表格中的信息从 Google 表格自动填充 Google 文档表格
- java - java.lang.IllegalStateException:运行 Junit 测试用例时无法加载 ApplicationContext
- python - PYTHON - 旋转多列,但分开
- php - 编写查询从 4 个表中提取信息
- python - docker-compose在创建docker镜像时找不到文件
- html - 固定每个打印页面上的页眉,并避免页脚内部出现分页符
- node.js - 在 MongoDB 中创建文档时如何使用 Mongoose 指定 _id 字段?
- javascript - 我在 jQuery 中的幻灯片代码有什么问题?
- android - 我可以使用什么来替代 Android 中的 DexFile?