错误:数据库类型为dbm.gnu,但该模块在Windows中不可用

时间:2018-06-23 07:08:42

标签: python-3.6 shelve dbm

我在Windows机器上安装了python3.6。并且在打开my.db文件时得到以下错误。

由我的程序在python3.6中的ubuntu16.04中使用搁置模块创建的my.db文件。

In [1]: import shelve

In [2]: db = shelve.open("etc/my.db")
---------------------------------------------------------------------------
error                                    Traceback (most recent call last)
<ipython-input-2-b4828c8ee6e1> in <module>()
----> 1 db = shelve.open("etc/my.db")

c:\Python36\Lib\shelve.py in open(filename, flag, protocol, writeback)
    241     """
    242
--> 243     return DbfilenameShelf(filename, flag, protocol, writeback)

c:\Python36\Lib\shelve.py in __init__(self, filename, flag, protocol, writeback)
    225     def __init__(self, filename, flag='c', protocol=None, writeback=False):
    226         import dbm
--> 227         Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
    228
    229

c:\Python36\Lib\dbm\__init__.py in open(file, flag, mode)
     89     elif result not in _modules:
     90         raise error[0]("db type is {0}, but the module is not "
---> 91                        "available".format(result))
     92     else:
     93         mod = _modules[result]

error: db type is dbm.gnu, but the module is not available

请帮助,如何在Windows中安装缺少的模块。

0 个答案:

没有答案