安裝pyodbc

std1984發表於2012-11-20
環境:Centos 5, python 2.7, greenplum, Oracle database, Oracle gateway
 
 
有一個專案使用python來將資料日誌匯入gp,同時還得執行oracle和gp的儲存過程,由於已經使用Oracle gateway配置好了ODBC連線,故而使用Python的ODBC連線。
 
到下載pyodbc-3.0.6.zip,
$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
>>>
'
目前至些安裝成功
 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/16582684/viewspace-749542/,如需轉載,請註明出處,否則將追究法律責任。

相關文章