如何修复 Mac OS X 10.5 Leopard 上默认 Python 包中损坏的 BSDDB 安装?

发布于 2024-07-18 18:47:43 字数 822 浏览 6 评论 0原文

使用开发人员工具在 Mac OS X 10.5 (Leopard) 上的默认 Python 安装上执行以下操作:

noel ~ : python

Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bsddb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/bsddb/__init__.py", line 51, in <module>
import _bsddb
ImportError: No module named _bsddb

不错吧? 如何解决这个问题而不放弃并按照 TMNC 的建议 或使用 MacPorts 等?

编辑

我通过 MacPorts 安装 Python2.4 和 BSDDB 解决了这个问题。

我的问题仍然存在:为什么默认安装被破坏以及是否可以修复它。

Do the following on the default Python install on Mac OS X 10.5 (Leopard) w/ Developer Tools:

noel ~ : python

Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bsddb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/bsddb/__init__.py", line 51, in <module>
import _bsddb
ImportError: No module named _bsddb

nice, huh? How do I fix this without giving up and installing/configuring/maintaining my own Python package as per TMNC's suggestion or using MacPorts etc?

Edit

I've gone around the problem by installing Python2.4 and BSDDB via MacPorts.

My question still stands: why is the default install broken and is it possible to fix it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

反话 2024-07-25 18:47:43

该补丁对我不起作用,我不得不替换 bsddb 文件夹
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7

与 bsddb3 位于:

/usr/local/lib/python2.7/site-packages/bsddb3

确保备份 bsddb 文件夹就在案件。

The patch did not work for me and I had to replace the bsddb folder in
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7

with the bsddb3 in:

/usr/local/lib/python2.7/site-packages/bsddb3

Make sure you backup the bsddb folder just in case.

过期以后 2024-07-25 18:47:43

这种痛苦在 OSX 10.8 上仍然存在。 我无法使用 macports py-bsddb3 将 bsddb3 安装到 virtualenv 中。 非常简单且有效的是:

  • 从 macports 下载安装 db53
  • 并解压 bsddb3 源代码 (https: //pypi.python.org/pypi/bsddb3/6.1.0)
  • sudo python setup.py –berkeley-db-incdir=/opt/local/include/db53 –berkeley-db-libdir=/opt/本地/lib/db53安装

This pain persists on OSX 10.8. I could not install bsddb3 using macports py-bsddb3 into a virtualenv. What was very simple and did work is:

  • install db53 from macports
  • download and unpack bsddb3 source (https://pypi.python.org/pypi/bsddb3/6.1.0)
  • sudo python setup.py –berkeley-db-incdir=/opt/local/include/db53 –berkeley-db-libdir=/opt/local/lib/db53 install
你是暖光i 2024-07-25 18:47:43

我找到的一个解决方案是安装 ActivePython,深入了解它的库(位于 /Library/Frameworks/Python.framework/Versions/....您的版本在这里..../lib)并复制并粘贴 _bsddb .so 文件放入我的 OS X 10.6 本机 python 2.6 安装目录 (/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/)。

这解决了缺少 _bsddb 的问题,让我在本机 python 安装中获得了 bsddb 的工作版本。 然后,我刚刚卸载了 ActivePython(此处的说明

A solution I found was to install ActivePython, dig into its library (located in /Library/Frameworks/Python.framework/Versions/....your version here..../lib) and copy and paste the _bsddb.so file into my OS X 10.6 native python 2.6 install directory (/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/).

That fixed the missing _bsddb issue leaving me with a working version of bsddb in my native python install. Then, I just uninstalled ActivePython (instructions here)

蓝眼睛不忧郁 2024-07-25 18:47:43

我遇到的错误是“没有名为 _bsddb 的模块”。 事实证明我不需要升级我的 bsddb。 我正在使用在 Windows 中创建的 .pkl 文件。 重命名 pkl 文件以将其删除后,Mac OSX Python 重新创建了一个新的 .pkl.db 文件,现在它可以完美运行。

The error I had was "No module named _bsddb". It turn out I didn't need to upgrade my bsddb. I wasusing the .pkl file created in windows. After renaming the pkl file to get it out the way Mac OSX Python recreated a new .pkl.db file and now it works perfectly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文