【问题标题】:DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found" - Not DuplicateDPI-1047:找不到 64 位 Oracle 客户端库:“找不到指定的模块”- 不重复
【发布时间】:2020-07-05 14:04:59
【问题描述】:

我尝试遵循堆栈溢出的所有可能答案,并尝试遵循与官方文档中提到的完全相同的步骤。

https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html

  1. 我有python 3.8 64bit
  2. 我有 Windows server 2019 64 位
  3. 我下载了版本 12.1.0.2.0 64 位 oracle 即时客户端。尝试了 Instant Client Package - Basic 和 Instant Client Package - Basic Light
  4. 将下载文件的路径设置为环境变量Path
  5. 重新启动系统。
import cx_Oracle

dsn_tns = cx_Oracle.makedsn('XXX', 'PORT', service_name='XXX') 
conn = cx_Oracle.connect(user=r'XXX', password='XXX', dsn=dsn_tns)


c = conn.cursor()
c.execute(r'select name,open_mode from v$database;') 
print(c)
conn.close()

我不知道还能做什么。仍然收到以下错误:

cx_Oracle.DatabaseError: 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 文件。但它仍然给出错误
  • 为什么不试试更新版本的即时客户端呢?并确保您遵循安装说明——特别是在 Windows 上,您需要确保安装了正确的可再发行组件。你没有在笔记中提到这一点。

标签: python cx-oracle


【解决方案1】:

扩展一些 cmets:

  • 请提供更多详细信息,以便我们了解您想要做什么。特别是您的数据库是远程还是在同一台计算机上?这将决定您是否需要 Instant Client

  • Windows 的安装说明为https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html#installing-cx-oracle-on-windows

  • 使用 Instant Client 19.6,因为它可以连接到 Instant Client 12 可以连接的相同范围的数据库版本。但它有更多的功能和修复。

  • 确保您安装了正确的 Windows VS 可再发行组件。这是一个常见的问题。

  • 根据您设置 PATH 的方式,您可能需要重新启动终端窗口以获取更新后的值。向我们展示您将 PATH 设置为的内容。请注意,使用 Windws 上的 cx_Oracle 8,您可以使用 init_oracle_client() 而不是设置 PATH,但您需要在每个 python 脚本中调用它。用法见文档。

【讨论】:

  • 我尝试使用最新版本,但我拥有的一些数据库不支持它,例如 10g
猜你喜欢
  • 1970-01-01
  • 2020-11-23
  • 2019-09-13
  • 1970-01-01
  • 2019-12-06
  • 2019-05-11
  • 1970-01-01
  • 2019-01-06
  • 2022-11-07
相关资源
最近更新 更多