步骤
-
mkdir /opt/oracle
-
cd /opt/oracle
2_1. rz(上传下载好的三个文件)
2_2. yum install unzip(如果没安装这个命令的话,执行这个命令)
-
unzip instantclient-basic-linux.x64-11.2.0.4.0.zip
-
unzip instantclient-sdk-linux.x64-19.3.0.0.0dbru.zip
-
cd instantclient_19_3/
-
ln -s libclntsh.so.11.1 libclntsh.so
-
export LD_RUN_PATH=/opt/oracle/instantclient_19_3/
-
export ORACLE_HOME=/opt/oracle/instantclient_19_3/
9.cd …/
- tar -zxvf cx_Oracle-7.2.2.tar.gz
11.cd cx_Oracle-7.2.2
-
python setup.py install
-
pip install cx_Oracle==7.2.2
14.python3
-
import cx_Oracle
-
cx_Oracle.connect(‘USERNAME/PWD@IP:PORT/orcl’) # 不报错,说明安装成功,会返回一个对象地址
17.如果有问题加上如下步骤:
1.vim /etc/profile
2.最后一行加上:export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_3:$LD_LIBRARY_PATH
3.source /etc/profile