如何安装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用户,于是整理此文。 2 基础知 …

Linux基础
如何在救援模式下启动SSH服务?

1 前言 一个问题,一篇文章,一出故事。 笔者最近想使用Linux救援模式进入系统进行远程的修复工作 …

Linux基础
如何熟悉SSH客户端?

1 前言 一个问题,一篇文章,一出故事。 笔者作为一个Linux运维人员,用过几款喜欢的Open S …