ubuntu python install oracle module cx_Oracle

前端之家收集整理的这篇文章主要介绍了ubuntu python install oracle module cx_Oracle前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
apt-get install build-essential unzip python-dev libaio-dev
sudo apt-get install alien
axel -n 10 "http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-basic-12.2.0.1.0-1.i386.rpm?AuthParam=1495872565_a046f44ac7d5a2d7f47f29746e57282d"

sudo alien -i oracle-instantclient12.2-basic-12.2.0.1.0-1.i386.rpm

axel -n 10 "http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm?AuthParam=1495872755_9542a241664febd3f7ab2b8bb7ee894d"

axel -n 10 "http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm?AuthParam=1495873553_cfbb390cd8691a945e872bb030357843"
alien -i oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm

#export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib/
#export ORACLE_HOME=/usr/lib/oracle/12.2/
#export LD_RUN_PATH=/usr/lib/oracle/12.2/
sudo pip install cx_oracle

简单测试

import cx_Oracle
db=cx_Oracle.connect('1','1','1:1521/ora11g')
print db.version
cursor = db.cursor() 
cursor.execute("select * from xxx")
result = cursor.fetchall()
db.close()

猜你在找的Ubuntu相关文章