本文介绍了如何让ibm_db或PyDB2 python模块与Mac OS X 10.7 Lion中的DB2配合使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这个问题/答案在Lion中安装DB2:

I used this question/answer to install DB2 in Lion: How do I install IBM DB2 Express-C on Mac OS X 10.7 Lion?

配置后我的数据库,我可以使用命令行中的db2来执行查询,但python模块ibm_db和PyDB2都无法导入并出现以下错误:

After configuring my databases, I am able to use db2 from the command line to execute queries, but the python modules ibm_db and PyDB2 both fail to import with the following error:

>>> import ibm_db
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.7/site-packages/ibm_db-1.0.4-py2.7-macosx-10.7-intel.egg/ibm_db.so, 2): Symbol not found: _dsIsDirServiceRunning
 Referenced from: /Users/<username>/sqllib/lib64/libdb2.dylib
 Expected in: /System/Library/Frameworks/DirectoryService.framework/Versions/A/DirectoryService

我如何解决这个问题,让ibm_db和PyDB2与Lion在Lion中正常工作?

编辑:移动回答答案

推荐答案

您可以更改db2库使用install_name_tool查看DirectoryService.framework的复制版本,因此您不必更改DYLD_LIBRARY_PATH

You can change the db2 libraries using install_name_tool to look at the copied version of DirectoryService.framework, so you don't have to change DYLD_LIBRARY_PATH

完全信用到以下,我只是更新此线程已经通过在Lion上安装db2 / ibm_db的过程,并通过Google查找此线程作为顶级命中之一。

Full credit goes to the following, I am simply updating this thread having been through the process of install db2 / ibm_db on Lion and finding this thread as one of the top hits via Google.

与此处描述的其他选项:

with other options described here:

答案(上面的线程应该消失):

The answer (should the above thread disappear):

复制Snow Leopard DirectoryService .framework to

Copy the Snow Leopard DirectoryService.framework to

/opt/SL_Frameworks/DirectoryService.framework

然后

cd /opt/IBM/db2/V9.5/
install_name_tool -change /System/Library/Frameworks/DirectoryService.framework/Versions/A/DirectoryService /opt/SL_Frameworks/DirectoryService.framework/Versions/A/DirectoryService lib64/libdb2sec.dylib
install_name_tool -change /System/Library/Frameworks/DirectoryService.framework/Versions/A/DirectoryService /opt/SL_Frameworks/DirectoryService.framework/Versions/A/DirectoryService lib64/libdb2.dylib

引用的帖子提到更改第三个库

The referenced post mentions changing a third library

libdb2e.dylib

但是,我只安装了db2客户端以使用ibm_db python模块,而这个库不存在。

however, I have only installed the db2 client to use the ibm_db python module and this library is not present.

这篇关于如何让ibm_db或PyDB2 python模块与Mac OS X 10.7 Lion中的DB2配合使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 12:00