Linux上Python27安装cx_Oracle连接Oracle11g

Linux上Python27安装cx_Oracle连接Oracle11g

1、安装oracle客户端
(1)安装客户端软件(https://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html)
#rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm

(2)配置环境变量
[root@redaht69 tmp]# tail -15 /etc/profile
#oracle_client11
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
#export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG='simplified chinese_china'.ZHS16GBK
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH

2、安装cx_Oracle
(1)配置pip源码
[root@redaht69 ~]# vi /root/.pip/pip.conf
[global]
trusted-host=mirrors.aliyun.com
index-url=http://mirrors.aliyun.com/pypi/simple/
(2)安装cx_Oracle
#pip27 install cx_Oracle(也可指定安装版本#pip27 install cx_Oracle==7.1.3)
3、配置主机解析(客户端的主机名和IP要正确)
[root@redaht69 tmp]# hostname
redaht69
[root@redaht69 tmp]# vi /etc/hosts
192.168.1.161 redaht69

猜你喜欢

转载自www.cnblogs.com/qqran/p/10890014.html