[英]gdbm with python3.9 unable to open a file created by gdbm with python 3.6
I upgraded from python 3.6 to python 3.9 and now the existing gdbm file is not getting read.我从 python 3.6 升级到 python 3.9,现在没有读取现有的 gdbm 文件。 Following error is being thrown, is there any way to fix this?
出现以下错误,有什么办法可以解决这个问题吗?
Platform: CentOS Linux release 7.9.2009 (Core)平台:CentOS Linux 发布 7.9.2009(核心)
Python: 3.9.9 Python:3.9.9
With Python 3.6 version I created the file in the first place using like this:使用 Python 3.6 版本,我首先使用如下方式创建了文件:
self.def_id_seq_map_db = dbm.open(str(self.datapath / "def_id_seq_map"), 'c')
self.def_id_seq_map = shelve.Shelf(self.def_id_seq_map_db)
The error when I try to read with Python 3.9:当我尝试使用 Python 3.9 阅读时出现错误:
File "/usr/local/lib/python3.9/dbm/__init__.py", line 91, in open
raise error[0]("db type is {0}, but the module is not "
dbm.error: db type is dbm.gnu, but the module is not available
It seems you installed Python from sources.看来您从源安装了 Python。 You may not have gdbm-devel installed on your system.
您的系统上可能没有安装 gdbm-devel。
What I would try:我会尝试什么:
./configure --enable-optimizations && \ make install
./configure --enable-optimizations && \ make install
配置/安装 python--with-dbmliborder=gdbm:ndbm
--with-dbmliborder=gdbm:ndbm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.