我尝试遵循Stack溢出的所有可能答案,并尝试遵循与官方文档中所述完全相同的步骤。
https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html
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
答案 0 :(得分:0)
展开一些评论:
给我们更多详细信息,以便我们知道您要做什么。特别是您的数据库是远程的还是在同一台计算机上?这将确定您是否需要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脚本中调用它。用法显示在文档中。