PyDB2最新的更新是2008的PyDB2_1.1.1,在ubuntu14.0464位下直接安装不成功。需要做一些修改
一、解压后打开setup.py
找到#DB2_ROOT = "/opt/IBM/db2/V8.1/"
改为DB2_ROOT = "/opt/ibm/db2/V10.5"(实际的安装路径)
二、还是在setup.py下
找到 for path in ['lib','lib32', 'lib64']:
改为 for path in ['lib64','lib32', 'lib']:
三、安装PyDB2模块
即:python setup.pybuild
sudo python setup.py install
四、测试
$ python
Python 2.7.6 (default, Mar 22 2014,22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for moreinformation.
>>> import DB2
>>> conn = DB2.connect(dsn='sample',uid='db2inst1', pwd='you_passwd')
如果没有错误信息、说明安装成功了