我是一个全新的python新手,当我尝试导入bsdddb时,我会收到以下消息。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bsddb/__init__.py", line 67, in <module>
import _bsddb
ImportError: No module named _bsddb所以我关注了this和this,所以我下载了这个包bsddb3-4.5.0.tar.gz。我想用它做什么,我试着在正确目录的bsddb3-4.5.0中运行python install setup.py (我使用的是osx)。然后我就得到了
Can't find a local BerkeleyDB installation.
(suggestion: try the --berkeley-db=/path/to/bsddb option)有人能帮上忙吗?
发布于 2013-06-20 20:10:57
bsddb为deprecated since 2.6。理想的做法是使用the bsddb3 module。
我的建议是,也是目前为止最简单的选择,就是安装Homebrew并使用它在您的系统上安装BerkeleyDB:
brew install berkeley-db之后,使用pip安装bsddb3
pip install bsddb3或者下载source并正常安装。
python setup.py install发布于 2015-12-02 19:34:21
我也遇到过类似的问题,但没有一个建议对我有效,因为我不能使用AGPL许可或Oracle的商业Berkeley许可。
BERKELEYDB_DIR=$(brew --cellar)/berkeley-db/6.1.26 pip install bsddb3
Collecting bsddb3
Using cached bsddb3-6.1.1.tar.gz
Complete output from command python setup.py egg_info:
Trying to use the Berkeley DB you specified...
Detected Berkeley DB version 6.1 from db.h
******* COMPILATION ABORTED *******
You are linking a Berkeley DB version licensed under AGPL3 or have a commercial license.
AGPL3 is a strong copyleft license and derivative works must be equivalently licensed.
You have two choices:
1. If your code is AGPL3 or you have a commercial Berkeley DB license from Oracle, please, define the environment variable 'YES_I_HAVE_THE_RIGHT_TO_USE_THIS_BERKELEY_DB_VERSION' to any value, and try to install this python library again.
2. In any other case, you have to link to a previous version of Berkeley DB. Remove Berlekey DB version 6.x and let this python library try to locate an older version of the Berkeley DB library in your system. Alternatively, you can define the environment variable 'BERKELEYDB_DIR', or 'BERKELEYDB_INCDIR' and 'BERKELEYDB_LIBDIR', with the path of the Berkeley DB you want to use and try to install this python library again.
Sorry for the inconvenience. I am trying to protect you.
More details:
https://forums.oracle.com/message/11184885
http://lists.debian.org/debian-legal/2013/07/
******* COMPILATION ABORTED *******然而,恢复到较旧的版本修复了这个问题。
使用brew安装旧版本的berkeley-db
brew install berkeley-db4
然后按照建议使用pip安装bsddb3
pip install bsddb3
然后
BERKELEYDB_DIR=$(brew --cellar)/berkeley-db4/4.8.30 pip install bsddb3
(修改自Stefan Schmidt的评论,以引用较旧的berkeley-db version目录)
最后,按照here的说明,将补丁应用到dbhash.py。
发布于 2016-10-20 01:45:49
@bamdan的答案是使用较旧版本的Berkeley DB,如果您仍想使用最新版本的Berkeley DB,
pip install berkeley-db
YES_I_HAVE_THE_RIGHT_TO_USE_THIS_BERKELEY_DB_VERSION以指示您拥有许可证cellar(brew--BERKELEYDB_DIR=$)/berkeley-db4/6.1.26 YES_I_HAVE_THE_RIGHT_TO_USE_THIS_BERKELEY_DB_VERSION=yes pip install bsddb3
https://stackoverflow.com/questions/16003224
复制相似问题