我正在尝试在“my.db”中查找“密钥”。我做了以下事情:
import shelve
db_file = os.path.join(self.path_data, 'my_directory', 'my.db')
s = shelve.open(db_file)
val = s["key"]
我收到此错误:
/opt/Python-2.4.3/lib/python2.4/shelve.py in open(filename='/path_here/dir/netmhcpan.db', flag='c', protocol=None, writeback=False, binary=None)
/opt/Python-2.4.3/lib/python2.4/shelve.py in __init__(self=<DbfilenameShelf instance>, filename='/path_here/dir/netmhcpan.db', flag='c', protocol=None, writeback=False, binary=None)
/opt/Python-2.4.3/lib/python2.4/anydbm.py in open(file='/path_here/dir/netmhcpan.db', flag='c', mode=438)
......
ImportError: No module named _bsddb
args = ('No module named _bsddb',)
感谢您解决此问题的任何帮助。感谢。
答案 0 :(得分:2)
安装db4-devel
等,然后重建Python。