use*_*830 21 python macos installation package
我是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
Run Code Online (Sandbox Code Playgroud)
所以我按照这个和这个,所以我下载了这个包bsddb3-4.5.0.tar.gz
.我想用它做什么,我试图在正确的目录中运行python install setup.py int bsddb3-4.5.0(我使用的是osx).然后我明白了
Can't find a local BerkeleyDB installation.
(suggestion: try the --berkeley-db=/path/to/bsddb option)
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?
Fra*_*que 16
bsddb is deprecated since 2.6. The ideal is to use the bsddb3 module.
My suggestion, and by far the easiest option, is to install Homebrew and use it to get BerkeleyDB on your system:
brew install berkeley-db
Run Code Online (Sandbox Code Playgroud)
After this install bsddb3 using pip
pip install bsddb3
Run Code Online (Sandbox Code Playgroud)
or download the source and install normally.
python setup.py install
Run Code Online (Sandbox Code Playgroud)
bam*_*dan 10
我有一个类似的问题,但没有一个建议对我有用,因为我无法使用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 *******
Run Code Online (Sandbox Code Playgroud)
但是,恢复到旧版本修复它.
使用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 版本目录)
最后,应用补丁的描述dbhash.py 这里.
如果您仍想使用最新的Berkeley DB,@ bamdan的答案使用旧版本的Berkeley DB,
首先,安装最新的Berkeley DB
pip install berkeley-db
Run Code Online (Sandbox Code Playgroud)其次,设置一个环境变量YES_I_HAVE_THE_RIGHT_TO_USE_THIS_BERKELEY_DB_VERSION
以表明您拥有许可证
BERKELEYDB_DIR=$(brew --cellar)/berkeley-db4/6.1.26 YES_I_HAVE_THE_RIGHT_TO_USE_THIS_BERKELEY_DB_VERSION=yes pip install bsddb3
Run Code Online (Sandbox Code Playgroud)