-
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html下载oracle的精简版客户端
oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
-
把下载的两个文件上传到liunx上,并解压到同一个目录,我的目录叫做cx-oracle,执行下面的命令
alien-ioracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
alien-ioracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
alien-ioracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
注意:
如果alien,请执行语句:sudo apt-get install alien
-
测试连接
sqlplususername/password@//dbhost:1521/SID#32位liunx操作系统
sqlplus64username/password@//dbhost:1521/SID#64为liunx操作系统
连接成功如图所示:
注意:
如果提示错误为:
sqlplus: command not found
sqlplus64: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory’
sudoapt-getinstalllibaio1#
sudoapt-getinstalllibaio1:i386#如果您在64位上安装32位客户端
如果按照还是不可以,建议你从第一步开始重新安装一次就可以。
-
这个时候可以pip install cx_Oracle
本教程只支持cx-Oracle==5.2.1版本,其他版本没有错尝试,可能会报错
import cx_Oracle成功