安装pyodbc

环境:Centos 5, python 2.7, greenplum, Oracle database, Oracle gateway
有一个项目使用python来将数据日志导入gp,同时还得运行oracle和gp的存储过程,由于已经使用Oracle gateway配置好了ODBC连接,故而使用Python的ODBC连接。
$unzip pyodbc-3.0.6.zip
$cd pyodbc-3.0.6
$python setup.py build
$python setup.py install
running install
running build
running build_ext
running install_lib
copying build/lib.linux-x86_64-2.7/pyodbc.so -> /usr/local/lib/python2.7/site-packages
error: /usr/local/lib/python2.7/site-packages/pyodbc.so: Permission denied
可知用户权限问题,进而
$sudo python setup.py install
python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
只好将pyodbc.so拷贝到/usr/local/lib/python2.7/site-packages目录下
$sudo cp pyodbc.so /usr/local/lib/python2.7/site-packages/
$pythonPython 2.7.3 (default, Nov 14 2012, 21:35:04)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import pyodbc
>>>
目前至些安装成功

作者: hqiang1984

量化自我,极简主义