如何安装Python cx_Oracle?

Linux基础

1 前言

一个问题,一篇文章,一出故事。
笔者安装Python的cx-oracle包发现依赖于oracle客户端,于是整理此文。

2 最佳实践

2.1 系统环境配置

2.1.1 系统环境

OS = CentOS 7.3 x86_64
Host Name = any.cmdschool.org
IP Address = any

2.2 安装Oracle库

2.2.1 配置安装源

vim /etc/yum.repos.d/oracle-instant-client.repo

加入如下配置,

[oracle-instant-client]
name=oracle-instant-client
baseurl=https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64
gpgcheck=0

2.2.2 安装软件包

yum install -y oracle-instantclient18.3-basic

2.2.3 注册库文件

echo /usr/lib/oracle/18.3/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf

2.2.4 确认安装

ldconfig -v 2> /dev/null | grep libclntsh.so

可见如下显示,

        libclntsh.so.18.1 -> libclntsh.so.18.1

2.3 安装cx_Oracle

pip install -i https://pypi.tuna.tsinghua.edu.cn/simpl oracle

参阅文档
============
Oracle Instant Client
———————
https://www.oracle.com/database/technologies/instant-client.html

cx-oracle
——————–
https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html

没有评论

发表回复

Linux基础
如何注销Linux用户并禁止其登陆?

1 前言 一个问题,一篇文章,一出故事。 今天笔者基于数据同步的需求需要限制数据上传用户登陆,因此整 …

Linux基础
如何卸载guardicore?

1 前言 一个问题,一篇文章,一出故事。 今天在测试环境发现yum安装异常,报无法与源服务器通讯。 …

Linux基础
如何解码audit日志的name字符串?

1 前言 一个问题,一篇文章,一出故事。 最近发现Oracle Linux的“/var/log/au …