【问题标题】:Trouble installing cx_Oracle - Python?安装 cx_Oracle - Python 时遇到问题?
【发布时间】:2022-01-03 12:42:04
【问题描述】:

我一直在尝试使用 PyCharm 安装 cx_Oracle,它已成功安装,但我导入并运行脚本时出现以下错误:

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 for help

我该如何解决这个问题?

【问题讨论】:

  • 您是否阅读了错误信息中提到的文档?
  • 是的,但是按照步骤操作后仍然无法解决错误

标签: python python-import cx-oracle dpi


【解决方案1】:

它现在指的是您需要在代码中指向的 Oracle 实例客户端。

请阅读the docs

代码应如下所示:

import cx_Oracle
cx_Oracle.init_oracle_client(lib_dir=r"C:\oracle\instantclient_19_6")

【讨论】:

    【解决方案2】:

    我认为您需要将客户端指向您的代码,以便它可以连接到 Oracle 数据库。试试这个:

    1. 使用pip 安装库
    pip install cx_Oracle
    
    1. 导入库并使用其函数init_oracle_client 作为客户端指向一个文件。
    import cx_Oracle as oc
    
    oc.init_oracle_client(lib_dir=r<your path>)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-16
      • 2013-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-23
      • 2016-06-18
      • 1970-01-01
      相关资源
      最近更新 更多