Python cx“Oracle错误”;DPI-1047:找不到32位Oracle客户端“;

Python cx“Oracle错误”;DPI-1047:找不到32位Oracle客户端“;,oracle,oracle11g,python-3.6,cx-oracle,Oracle,Oracle11g,Python 3.6,Cx Oracle,如何修复此错误,我使用python3.6和Oracle database 11g,我想将python连接到Oracle数据库,但显示错误,我如何修复它 这是我的代码: #importing module import cx_Oracle #create a table in oracle database try: con = cx_Oracle.connect('db_employees/root@localhost') #Now execute the sqlquery

如何修复此错误,我使用python3.6和Oracle database 11g,我想将python连接到Oracle数据库,但显示错误,我如何修复它

这是我的代码:

#importing module
import cx_Oracle

#create a table in oracle database
try:
    con = cx_Oracle.connect('db_employees/root@localhost')

    #Now execute the sqlquery
    cursor = con.cursor()
    cursor.execute("insert into employees values(2171114103970002, raden, ceo, 01031997, batam, 001)")

    #commit that insert the provided database
    con.commit()
except cx_Oracle.DatabaseError as e:
    print("There is a problem with Oracle", e)

#by writing finally if any error occurs
#then also we can close the all database operation
finally:
    if cursor:
        cursor.close()
    if con:
        con.close()
这是错误消息:

C:\Python36>python "D:\testing.py"
There is a problem with Oracle DPI-1047: Cannot locate a 32-bit Oracle Client library: "The specified module could not be found". See https://oracle.github.io/odpi/doc/installation.html#windows for help
Traceback (most recent call last):
  File "D:\testing.py", line 20, in <module>
    if cursor:
NameError: name 'cursor' is not defined
C:\Python36>python“D:\testing.py”
Oracle DPI-1047存在问题:找不到32位Oracle客户端库:“找不到指定的模块”。看见https://oracle.github.io/odpi/doc/installation.html#windows 求救
回溯(最近一次呼叫最后一次):
文件“D:\testing.py”,第20行,在
如果光标:
NameError:未定义名称“游标”

检查路径,查看客户端是否在路径上,在某些情况下,路径未设置为指向客户端,或者路径上包含无效字符,python库无法访问该路径


您可以在此处查看类似问题

以下是安装说明:


错误是说您需要一个32位Oracle客户端库。您可以从(64位库,如果有人需要的话)任何版本都可以连接到Oracle DB 11.2。说明在这一页的底部。确保安装了正确的VS可再发行版本。

我也遇到了同样的问题,下面是我如何解决这个问题的步骤-

  • 从以下位置下载最新64位版本的oracle basic instantClient:
  • 就我而言,我已经下载了-windows.x64-19.10.0.0.0dbru.zip

  • 解压缩Oracle instantClient并复制所有.dll文件

  • 将这些.dll文件从Oracle instantclient目录复制到python目录


  • 请查看您如何格式化代码。我已经编辑了你的文章,使其格式清晰。我已经按照github上显示的步骤进行了操作,但仍然没有成功,仍然存在错误。我使用Python 3.6.5(32位)cx_Oracle 7.2.1 Windows 10(64位)。这是我在32位和64位中安装的详细信息错误。谢谢Christopher,第二个链接帮助了我。但是第一个已经损坏了。我已经更新了它们-谢谢。(如果有疑问,请尝试谷歌!)