【cx_Oracle】DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified mod

python调用oracle报错:Linux oracle DPI-1047: Cannot locate a 64-bit Oracle Client library: libclntsh.so cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: libclntsh.so。libclntsh.so是OCI客户端运行时库,Oracle如果程序使用了oci读写数据库必定会装载这个库。一般位于你安装的oracle客户端目录下,程序运行时会去两个路径下寻找:1、/etc/ld.so.conf所列路径下;如果这两个地方都找不到就会报错,说找不到这个库。 阅读详情

从报错开始梳理用Python连接Oracle数据库

【操作步骤】

1.搭建环境:

win7-64、python-3.7.3、Oracle客户端:instantclient

2.下载库包:

python -m pip install cx_Oracle

3.导入模块:

import cx_Oracle

4.建立连接:

db = cx_Oracle.connect(“username”,“password”,“hostname/service_name”)

5.创建游标:

cursor = db.cursor()

6.执行事务:

#执行SQL语句
cursor.execute(sql)
#获取一条结果
cursor.fetchone()
#获取全部结果
cursor.fetchall()

7.关闭资源
db.close()

import cx_Oracle
conn = cx_Oracle.connect("root","rootroot","192.168.110.110/orcl")
cursor = conn.cursor()
sql = "select * from T1"
cursor.execute(sql)
result = cursor.fetchall()
for row in result:
    pass
conn.close()

以上步骤是标准步骤,但是需要一些小的处理技巧。如果你导入库之后直接建立连接,会报如下错误:

DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: “The specified module could not be found”. See https://oracle.github.io/odpi/doc/installation.html#windows for help

如果出现这条报错,说明python和oracle客户端还是没有建立连接,需要将扩展包导入到python放包的目录,操作如下:
1.找到oracle客户端安装路径,复制三个扩展包,分别为:oci.dll、oraociei11.dll、oraocci11.dll
2.找到python的~/lib/site-packages/,粘贴三个扩展包
3.重新建立连接即可
同样,因为我电脑里面本身就有这些环境,所以并没有发生其他的错误,比较顺利。

cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: 首先确定pthon版本和oracle客户端版本一致即可,即都为64位或都为32位。 但我这里要讲的是如何解决这个问题的过程: 在python中的报错中提示了这个: DPI-1047: Cannot locate a 64-bit Oracle Client library: “The specified module could not be found”. See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html 阅读详情

相关推荐

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 一起使用,则将这些文件 在可访问的目录中,例如 中。

qq_39038793的博客 1473

cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library

oracle连接问题

simple_code 5819

C#实战:如何从零构建一个轻量级软PLC梯形图编辑器(附完整源码)

本文详细介绍了如何使用C#从零开始构建一个轻量级软PLC梯形图编辑器。内容涵盖项目架构设计、GDI+图形渲染、编辑交互实现以及核心的扫描执行引擎开发,并提供了定时器、计数器等高级功能的实现思路与完整源码,为开发者深入工业自动化领域提供了实战指南。

4k5l6j7h8的博客 258

cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit O

在使用python连接oracle的时候,出现以上错误,如果本地有安装oricle的客户端的话,可以参考这个博客进行解决,使用cx_Oracle连接数据库时报错: cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library_流年小青年的博客-优快云博客_cx_oracle.databaseerror我没有安装oricle的客户端,因为我使用navicat连接过oracle,所以将navicat安装目录中的文

simple_code 1万+

set_output_delay的本质

set_output_delay的本质

qq_33300585的博客 3393

手把手教你分析解决Innovus DRC Violation 和Antenna Effect Violation

数字IC后端设计培训教程之手把手教你分析解决Innovus DRC Violation 和Antenna Effect Violation

weixin_37584728的博客 2942

cx_Oracle DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library XXX

cx_Oracle报错:cx_Oracle DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library

qq_43723172的博客 5401

别再手动转格式了!用Java+LibreOffice命令行实现Word批量转PDF(附Docker部署避坑指南)

本文详细介绍了如何利用Java和LibreOffice命令行实现企业级Word批量转PDF的自动化解决方案,包括多线程优化、Docker化部署及常见问题排查。通过代码示例和实战经验,帮助开发者高效处理文档转换需求,提升工作效率并避免常见陷阱。

552

cx_oracle DPI-1047报错解决方案

问题 python使用cx_oracle连接数据库时报错 DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory". See https://oracle.github.io/odpi/doc/installation.html#linux for help. 解决 问题的原因是找不到动态链接文件,一般.s

am540的博客 1万+

【乐企-工具篇】有关乐企发票文件生成- OFD和PDF文件生成

有关乐企发票文件生成-OFD和PDF文件生成

九七的博客 2055

【DRAM存储器五十一】LPDDR5介绍--DFE与Pre-Emphasis

简述LPDDR5的DFE和预加重应用设置

highman110的博客 710

15分钟解决此问题,DPI-1047: Cannot locate a 64-bit Oracle Client library: “The specified module could not be

花了5小时研究,15分钟可解决此问题DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be

m0_68335484的博客 1万+

【100%通过率】华为OD机试真题 Python 实现【字符串重新排列】【2022.11 Q4新题】

给定一个字符串s,s包括以空格分隔的若干个单词,请对s进行如下处理后输出: 1、单词内部调整:对每个单词字母重新按字典序排序 2、单词间顺序调整: 1)统计每个单词出现的次数,并按次数降序排列 2)次数相同,按单词长度升序排列 3)次数和单词长度均相同,按字典升序排列 请输出处理后的字符串,每个单词以一个空格分隔。

MISAYAONE的博客 7982

oracle error: (cx_Oracle.DatabaseError) DPI-1047: Cannot locate a 64-bit Oracle Client library

Python报错 oracle error: (cx_Oracle.DatabaseError) DPI-1047: Cannot locate a 64-bit Oracle Client library: 报错原因: 1、未下载oracle客户端 2、python和oracle客户端的位数不一致,python版本为64位,instantclient版本为32位,需更换成64位。 解决办法: ...

baidu_41805096的博客 5544

学Simulink--进阶电机控制场景实例:基于Simulink的异步电机定子磁链定向控制(SFOC)仿真

本文详细介绍了基于Simulink的异步电机定子磁链定向控制(SFOC)仿真实现方法。主要内容包括:1) SFOC原理分析,突出其对转子参数不敏感的优势;2) 工业风机驱动系统的完整建模流程,涵盖主电路搭建、坐标变换、磁链观测器设计等关键步骤;3) 核心模块代码实现,包括电压模型磁链观测器和双闭环PI控制器;4) 仿真结果验证了SFOC在转速响应(0.2s)、转矩恢复(0.15s)和参数鲁棒性(转子电阻变化50%时转速波动<2%)方面的优异性能。本文为工程师提供了实用的SFOC系统开发指南,特别适用于

amy_mhd的博客 117

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

DPI-1047:Cannot locate a 64-bit Oracle Client library:The specified module could not be found

解决python cx_Oracle模块DPI-1047:Cannot locate a 64-bit Oracle Client library: 通过python的cx_Oracle模块连接服务器Oracle数据库时报错。 解决方法 指定包含Oracle Instant Client库的目录: 客户端环境: win10 64位 python版本: Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (

bill_love_c的博客 8397

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

linux python cx_Oracle:DPI-1047:cannot locate a 64-bit oracle client library:“libclntsh.so“ 解决办法

DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory" 解决方案

yaoleifeng的博客 6222

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

DPI-1047:Cannot locate a 64-bit Oracle Client library:The specified module could not be found.

最近在使用python连接Oracle,在初次使用时,出现如下错误: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://oracle.github.io/odpi/doc/installation.html#windows fo...

家住海边,见过大风大浪 3万+

cx_Oracle连接数据库报DPI-1047: Cannot locate a 64-bit Oracle Client library

针对这个问题查了很多资料,大部分的说法是python版本、oracle客户端版本、操作系统都要是64位的。其实只需要pthon版本和oracle客户端版本一致即可,即都为64位或都为32位。 但我这里要讲的是如何解决这个问题的过程: 在python中的报错中提示了这个: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://cx-ora

wubiwu的专栏 2万+

Centos8 运行cx_oracle DPI-1047: Cannot locate a 64-bit Oracle Client library异常解决

关于 cx_oracle 模块在Centos 8上运行的问题

码农终结者的博客 1911

xc_oracle 1047 error,Error: DPI-1047: Cannot locate a 64-bit Oracle Client library: "问题

参考:python 打包后,在别的机器遇上运行,提示报错,报错内容为:Error: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See for help根本问题:打包时未将oracle dll文件打包进去,导致运行找不到链接库。临时解决办法:方...

weixin_28950543的博客 1640

python启动提示 cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library

python链接数据库提示Oracle客户端库与Python的架构不匹配,2、copy如下文件到python安装目录,即python.exe目录。1、检查python 位数是32/64 是否和oracle匹配。在Oracle客户端安装目录中,名称可能会包含架构信息。经过确认python是64,oracle也是64,匹配。2、如何快速确认oracle是32和64。1、解压本地,并配置到环境变量 参考截图。

舒婷(Zoe) 1928
上一篇: 【pymysql】AttributeError: module 'pymysql' has no attribute 'connect'
下一篇: 【面向对象】哪吒大战三太子
严小样儿
博客等级 码龄8年 183粉丝 21原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值