首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装bsddb包- python

安装bsddb包- python
EN

Stack Overflow用户
提问于 2013-04-15 03:15:02
回答 4查看 28.5K关注 0票数 22

我是一个全新的python新手,当我尝试导入bsdddb时,我会收到以下消息。

代码语言:javascript
复制
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

所以我关注了thisthis,所以我下载了这个包bsddb3-4.5.0.tar.gz。我想用它做什么,我试着在正确目录的bsddb3-4.5.0中运行python install setup.py (我使用的是osx)。然后我就得到了

代码语言:javascript
复制
Can't find a local BerkeleyDB installation.
(suggestion: try the --berkeley-db=/path/to/bsddb option)

有人能帮上忙吗?

EN

回答 4

Stack Overflow用户

发布于 2013-06-20 20:10:57

bsddb为deprecated since 2.6。理想的做法是使用the bsddb3 module

我的建议是,也是目前为止最简单的选择,就是安装Homebrew并使用它在您的系统上安装BerkeleyDB:

代码语言:javascript
复制
brew install berkeley-db

之后,使用pip安装bsddb3

代码语言:javascript
复制
pip install bsddb3

或者下载source并正常安装。

代码语言:javascript
复制
python setup.py install
票数 20
EN

Stack Overflow用户

发布于 2015-12-02 19:34:21

我也遇到过类似的问题,但没有一个建议对我有效,因为我不能使用AGPL许可或Oracle的商业Berkeley许可。

代码语言:javascript
复制
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。

票数 11
EN

Stack Overflow用户

发布于 2016-10-20 01:45:49

@bamdan的答案是使用较旧版本的Berkeley DB,如果您仍想使用最新版本的Berkeley DB,

  • 首先,安装最新的Berkeley DB

pip install berkeley-db

  • Second,设置环境变量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

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16003224

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档