Linux下Python3.6.5安装的cx_Oracle模块

Linux下安装cx_Oracle,连接oracle数据库 通过python连接oracle数据库,在Linux服务器运行时,缺少cx_Oracle模块,则需要在linux下安装对应的依赖,需要用到的依赖如下:①oracle客户端②cx_Oralce。 阅读详情

1、检查环境并下载cx_Oracle对应包

[root@kkk ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.4 (Maipo)

[root@kkk ~]# python3 -V
Python 3.6.5

cx_Oracle源码包:
https://pypi.python.org/pypi/cx_Oracle/5.2.1#downloads

2、上传cx_Oracle包到Linux并解压

[root@kkk soft]# ls -l /soft/cx_Oracle-5.2.1.tar.gz 
-rw-r--r-- 1 root root 113416 Jan 27 20:40 /soft/cx_Oracle-5.2.1.tar.gz

tar -xzvf cx_Oracle-5.2.1.tar.gz

[root@kkk soft]# ls -ld cx_Oracle-5.2.1*
drwxrwxr-x 7 kkk  kkk    4096 Jan 27 20:58 cx_Oracle-5.2.1
-rw-r--r-- 1 root root 113416 Jan 27 20:40 cx_Oracle-5.2.1.tar.gz

3、安装之前root用户相关环境变量设置

vi /etc/profile

export ORACLE_HOME=/u01/app/oracle/product/19.2.0.0.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH

source /etc/profile

4、开始安装

cd /soft/cx_Oracle-5.2.1/

[root@kkk cx_Oracle-5.2.1]# python3 setup.py build
running build
running build_ext
building 'cx_Oracle' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/u01/app/oracle/product/19.2.0.0.0/dbhome_1/rdbms/public -I/u01/app/oracle/product/19.2.0.0.0/dbhome_1/sdk/include -I/usr/local/python3/include/python3.6m -c cx_Oracle.c -o build/temp.linux-x86_64-3.6-11g/cx_Oracle.o -DBUILD_VERSION=5.2.1
In file included from /u01/app/oracle/product/19.2.0.0.0/dbhome_1/rdbms/public/oci.h:3883:0,
                 from cx_Oracle.c:10:
/u01/app/oracle/product/19.2.0.0.0/dbhome_1/rdbms/public/ociap.h:11070:1: warning: function declaration isn?. a prototype [-Wstrict-prototypes]
 void OCIThreadProcessInit();
 ^
/u01/app/oracle/product/19.2.0.0.0/dbhome_1/rdbms/public/ociap.h:11076:1: warning: function declaration isn?. a prototype [-Wstrict-prototypes]
 boolean OCIThreadIsMulti();
 ^
In file included from /u01/app/oracle/product/19.2.0.0.0/dbhome_1/rdbms/public/oci.h:3886:0,
                 from cx_Oracle.c:10:
/u01/app/oracle/product/19.2.0.0.0/dbhome_1/rdbms/public/ocixmldb.h:216:1: warning: function declaration isn?. a prototype [-Wstrict-prototypes]
 ub1 OCIXmlGetDiffBndVersion();
 ^
In file included from Variable.c:176:0,
                 from Cursor.c:246,
                 from Connection.c:761,
                 from SessionPool.c:138,
                 from cx_Oracle.c:203:
ObjectVar.c: In function ?.bjectVar_Initialize?.
ObjectVar.c:118:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < self->allocatedElements; i++) {
                   ^
ObjectVar.c: In function ?.bjectVar_Finalize?.
ObjectVar.c:135:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < self->allocatedElements; i++) {
                   ^
In file included from Cursor.c:246:0,
                 from Connection.c:761,
                 from SessionPool.c:138,
                 from cx_Oracle.c:203:
Variable.c: In function ?.ariable_NewByOutputTypeHandler?.
Variable.c:926:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (var->allocatedElements < cursor->fetchArraySize) {
                                ^
In file included from Connection.c:761:0,
                 from SessionPool.c:138,
                 from cx_Oracle.c:203:
Cursor.c: In function ?.ursor_GetArrayDMLRowCounts?.
Cursor.c:2440:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < rowCountArraySize; i++) {
                   ^
In file included from Connection.c:764:0,
                 from SessionPool.c:138,
                 from cx_Oracle.c:203:
Subscription.c: In function ?.essageTable_Initialize?.
Subscription.c:451:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < numRows; i++) {
                   ^
Subscription.c: In function ?.essageQuery_Initialize?.
Subscription.c:526:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < numTables; i++) {
                   ^
Subscription.c: In function ?.essage_Initialize?.
Subscription.c:618:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (i = 0; i < numTables; i++) {
                       ^
Subscription.c:660:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (i = 0; i < numQueries; i++) {
                       ^
creating build/lib.linux-x86_64-3.6-11g
gcc -pthread -shared build/temp.linux-x86_64-3.6-11g/cx_Oracle.o -L/u01/app/oracle/product/19.2.0.0.0/dbhome_1/lib -lclntsh -o build/lib.linux-x86_64-3.6-11g/cx_Oracle.cpython-36m-x86_64-linux-gnu.so

[root@kkk cx_Oracle-5.2.1]# python3 setup.py install
running install
running bdist_egg
running egg_info
writing cx_Oracle.egg-info/PKG-INFO
writing dependency_links to cx_Oracle.egg-info/dependency_links.txt
writing top-level names to cx_Oracle.egg-info/top_level.txt
reading manifest file 'cx_Oracle.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'cx_Oracle.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-3.6-11g/cx_Oracle.cpython-36m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg
creating stub loader for cx_Oracle.cpython-36m-x86_64-linux-gnu.so
byte-compiling build/bdist.linux-x86_64/egg/cx_Oracle.py to cx_Oracle.cpython-36.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying cx_Oracle.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying cx_Oracle.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying cx_Oracle.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying cx_Oracle.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
__pycache__.cx_Oracle.cpython-36: module references __file__
creating dist
creating 'dist/cx_Oracle-5.2.1-py3.6-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing cx_Oracle-5.2.1-py3.6-linux-x86_64.egg
creating /usr/local/python3/lib/python3.6/site-packages/cx_Oracle-5.2.1-py3.6-linux-x86_64.egg
Extracting cx_Oracle-5.2.1-py3.6-linux-x86_64.egg to /usr/local/python3/lib/python3.6/site-packages
Adding cx-Oracle 5.2.1 to easy-install.pth file

Installed /usr/local/python3/lib/python3.6/site-packages/cx_Oracle-5.2.1-py3.6-linux-x86_64.egg
Processing dependencies for cx-Oracle==5.2.1
Finished processing dependencies for cx-Oracle==5.2.1

5、测试是否安装成功

Python端:

[root@kkk soft]# python3
Python 3.6.5 (default, Jan 24 2020, 11:43:31) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> db1 = cx_Oracle.connect('scott/scott@192.168.59.16:1521/pdb01')
>>> print(db1.version)
19.0.0.0.0

Oracle端:

[oracle@kkk ~]$ sqlplus / as sysdba;

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jan 27 21:59:11 2020
Version 19.2.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.2.0.0.0

6、安装时遇到的错误

ImportError: libclntsh.so.19.1: cannot open shared object file: No such file or directory

导入模块时会用到$ORACLE_HOME/lib将其加入到$LD_LIBRARY_PATH中

/etc/profie下添加

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
source /etc/profile
linux安装oracle client解决cx_Oracle.DatabaseError: DPI-1047 或者,将文件放在 Instant 的子目录中 客户端,例如 . 这是链接的可执行文件的默认 Oracle 配置目录 使用此 Instant Client。在最新的 Linux 版本(如 Oracle Linux 8)上,您可能还需要 在使用 Oracle Instant Client 19 时安装软件包。使用 cx_Oracle 需要安装 Oracle 客户端库。如果使用可选的 Oracle 配置文件(如 )或与 Instant Client 一起使用,则将这些文件 在可访问的目录中,例如 中。 阅读详情

相关推荐

linux python cx_Oracle 安装

             python cx_Oracle安装详细过程                  最近安装python 的Oracle包,网上搜了一大堆,好多都没用,只好自己总结下整个安装过程吧 首先给大家推荐一个ubuntu官网上安装cx_Oracle网址:https://help.ubuntu.com/community/Oracle%20Instant%20Client 如果你...

一鸣惊人的专栏 1万+

Linux中安装cx_Oracle

Linux中安装cx_Oracle

duan_mo_ran的博客 2237

python安装cx_oracle_Python连接Oracle的插件cx_Oracle安装

安装cx_Oracle须知:首先安装配置时,必须把握一个点,就是版本一致!包括:系统版本,Python版本,oracle客户端的版本,cx_Oracle的版本,然后安装配置就容易了!如果已经安装Python,查看你安装的Python版本是多少位的,方法如下:>> > import platform>> > platform.architecture()查看O...

weixin_39688035的博客 640

linux cx_oracle,linux 安装cx_Oracle

一、安装必要的库yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel gcc python-devel二、安装setuptools下载setuptools安装包,并解压python setup.py install三、安装pip下载pip安装包,并解压python setup.py install四、...

weixin_39788986的博客 1005

python cx_Oracle依赖客户端在无网Linux下的安装

无网Linux安装oracle轻量客户端

qq_41242724的博客 2965

cx_Oracle离线安装包

Linux下cx_Oracle离线安装包,详情参考 https://blog.csdn.net/qq_36743482/article/details/80884190

linux环境下安装python的cx_Oracle包

cx_Oracle安装需要依赖oracle客户端的一些包, 所以我们经常安装cx_Oracle之前,而不得不先安装oracle客户端 但是cx_Oracle依赖的东西并不多,感觉有点得不偿失,所以下面给出一种解决方法能简单很多。 先下载instantclient-basic-linux.x64-11.2.0.4.0.zip,instantclient-sdk-linux.x64-11.2

wangcunlin的专栏 4146

Oracle离线安装的环境包

均为*.rpm 解压后执行 rpm -ivh *.rpm --nodeps --force 即可

linux环境下安装python3以及安装cx_Oracle模块需要注意的事项

linux环境下安装python3以及安装cx_Oracle模块需要注意的事项 python3的安装 1. 首先安装python3之前首先要安装python所依赖的环境 yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel rea...

feng7011的博客 2041

LabVIEW数据采集-数字I/O/计数器

labview 数据采集 数字I/O 计数器

weixin_43781045的博客 5617

实测对比:DECIMER、Img2Mol、MolScribe,哪个化学结构识别工具更靠谱?

化学结构识别(CSR)工具的核心任务是将分子结构图像转换为SMILES(Simplified Molecular Input Line Entry System)表示。这一过程需要克服图像质量差异、绘制风格变化以及特殊基团识别等挑战。三款工具采用不同的技术路线:DECIMER:基于EfficientNetV2+Transformer架构,优势在于处理标准期刊文献中的分子图示Img2Mol。

weixin_32576389的博客 345

Linux下安装Python的cx_Oracle模块

python 想远程访问 Oracle 数据库,需要 cx_Oralce 模块,又依赖Oracle Instant Client 代替完整的Oracle Clien 我的系统是Linux x86-64 ,可以输入 uname -a 命令来查看。所以下载以下两个文件:basic和sdk。 instantclient-basic-linux.x64-11.2.0.3.0.zip instantcl

wangshuang1631的博客 1万+

rk3568 rk628桥片 rgb2hdmi

RK628 是瑞芯微全新推出的视频桥接芯片,支持丰富的显示接口,支持高分辨率大屏产品转换需求。基于DRM、FB的显示框架易于使用。 输入信号支持:HDMI、RGB、BT.1120,输出信号支持 HDMI、GVI、Dual LVDS、Dual MIPI、MIPI-CSI、RGB、BT.1120,最高支持4K 60fps 输入/输出转换,并且支持输入到输出 1/4~4倍的缩放。

weixin_35723192的博客 451

cx_oracle安装教程,Python 安装 cx_Oracle

说明:本文档内容基于Python2.7.8版本进行操作。一、下载cx_Oracle二、下载Oracle客户端驱动(Oracle Instant Client Basic)三、Windows下载及安装3.1 选择下载文件3.2点击下载文件后,会进入到登陆页面,登陆后就可以下载了.3.3输入用户名密码后,点击登陆按钮,则会弹出文件下载框。3.4双击打开文件,全部都是下一步,完成安装。3.5...

weixin_39798031的博客 5920

Claude Code(1):手把手教你安装配置 Claude Code

Claude Code 是一款强大的 AI 编程助手工具,能够帮助开发者提升编码效率。本文将详细介绍如何在不同操作系统上安装和配置 Claude Code,让你快速上手这款工具。

blues_C的博客 752

笔试题-2023-乐鑫-数字IC设计【纯净题目版】

笔试题-2023-乐鑫-数字IC设计【纯净题目版】

w0shishabi的博客 1777

python cx_oracle 安装_Python 离线安装cx_Oracle

离线安装cx_Oracle步骤:1、系统环境:Linux环境:Redhat6.5,Python2.72、下载软件:oracle客户端官网下载地址:http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.htmloracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpmoracl...

weixin_39679370的博客 1743

SDA 还是 SDI:SAP HANA 数据虚拟化与数据集成的取舍、组合与实战

结论先放在前面:SDA 面向数据虚拟化与联邦查询,强调不落地、不复制、按需实时访问;SDI 面向数据集成与复制,强调抽取、转换、装载与近实时增量同步。两者共享 Remote Source 与 Adapter 的理念,但侧重点与运行时组件明显不同。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 583

Linux环境下Python连接Oracle

       最近公司要求在linux下对Mysql,Oracle进行增加用户,用户改密等操作。Mysql数据库实现起来比较简单,这个Oracle让我头疼了一阵。于是从网上查阅资料,经自己的测试以后终于成功,现将方法总结如下:python数据库接口python DB API支持非常多的数据库。python连接Oracle需要使用cx-Oracle。一、安装cx_Oracle1、下载组件:cx_Or...

center_line的博客 9165

科研级YOLO26下采样革新:ContextGuided模块赋能,让特征降维兼具上下文感知的实战指南

在文件夹下新建,将上述类的代码写入其中。这一步是为了让YOLO26的代码架构能识别我们的自定义下采样模块。

LXY_LOVE36的博客 100

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

Linux离线安装cx_Oracle & 在线安装cx_Oracle

注:无论是离线安装还是在线安装,核心都是①安装oracle客户端;②安装cx_Oralce。 通过Python程序连接Oracle数据库,放在Linux服务器执行,但是缺少cx_Oracle模块,并且服务器无法联网,通过离线的方式安装。 离线安装 1.准备 确定Python版本并下载相关的软件包。 Python 2.6.6,则需要下载cx_Oracle-5.2.1-11g-py26-1.x86_64.rpm 因而,三个需要下载的软件包及地址: cx_Oracle-5.2.1-11g-py26-1

Data & Analysis 2858

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

linux安装cx_Oracle模块

数据库版本为11.2,linux环境64位 去http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html下载oracle的精简版客户端,instantclient-basic-linux.x64-11.2.0.4.0.zip和instantclient-sdk-linux.x64-11.2.0.4.0.zip,下载需要登录

strwolf的专栏 5472

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

python cx oracle安装_python3.6的安装及cx_oracle安装

一、创建所需目录mkdir -p /home/用户名/software/python3.6.1mkdir -p /home/用户名/priv/bydmkdir -p /home/用户名/priv/byd/src/pythonmkdir -p /home/用户名/priv/byd/org二、修改byd目录的权限cd /home/用户名/priv/llchmod 777 byd/ll三、将安装包放到b...

weixin_39765869的博客 250

python cx_oracle_Python 安装 cx_Oracle

说明:本文档内容基于Python2.7.8版本进行操作。一、下载cx_Oracle二、下载Oracle客户端驱动(Oracle Instant Client Basic)三、Windows下载及安装3.1 选择下载文件3.2点击下载文件后,会进入到登陆页面,登陆后就可以下载了.3.3输入用户名密码后,点击登陆按钮,则会弹出文件下载框。3.4双击打开文件,全部都是下一步,完成安装。3.5...

weixin_39601511的博客 398

Python的cx_oracle模块安装,Linux中的cx_Oracle python模块安装

我想从Python脚本连接到Oracle数据库。为此,我正在尝试安装cx\u oracle Python模块。我的Linux机器上没有安装Oracle。在在安装cx_oracle module时,它会抛出错误,提示“找不到oracle软件安装”有没有任何方法可以在不安装Oracle的情况下从python连接到Oracle数据库呢。在-bash-4.1$ pip install cx_OracleD...

weixin_39603217的博客 263
上一篇: 一步一步搭建MySQL主从复制(Linux7.4_MySQL5.7)
下一篇: Python查询Oracle中指定表并收集其统计信息
Lissen_Gan
博客等级 码龄13年 11粉丝 44原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值