【问题标题】:Python - Oracle 11g connectionPython - Oracle 11g 连接
【发布时间】:2017-05-05 09:31:02
【问题描述】:

我想连接python和oracle 11g。 Python 版本 - 3.6.1 / 64 位,Windows 7 -64 位。

我已经从https://oracle.github.io/python-cx_Oracle/ 安装了 cx_Oracle 代码如下 -

import cx_Oracle

con = cx_Oracle.connect('sde/sde@orcl')
print (con.version)
con.close()

但我正在低于错误 -

C:\Python\Python36\python.exe 
D:/Automation/Python_WP/practice/database/db_connection.py
Traceback (most recent call last):
File "D:/Automation/Python_WP/practice/database/db_connection.py", line 1, in <module>
import cx_Oracle
ImportError: DLL load failed: The specified module could not be found.

Process finished with exit code 1

请告诉我为 Windows-7 64 位连接 Python 3.6.1 和 Oracle 11g 的步骤。

【问题讨论】:

  • 你是用pip安装的还是下载的?
  • 我已经安装了cx_Oracle-5.3-11g.win-amd64-py3.6-2.exe (md5)。
  • 使用 pip install cx_Oracle 并尝试。希望它能解决这个错误
  • C:\Python\Python36>pip install cx_Oracle 要求已经满足:c:\python\python36\lib\site-packages 中的 cx_Oracle
  • 我也下载了Oracle Instant Client。 > 并解压。将此路径设置为 Environment Variable 。 ORACLE_HOME:C:\instantclient\instantclient 然后安装 cx_Oracle 但仍然无法正常工作。 ImportError:DLL 加载失败:找不到指定的模块。面临上述错误。

标签: python


【解决方案1】:
1. Download msvcp71.dll and msvcr71.dll from the web.
2. Save them to your C:\Windows\System32 folder.
3. Save them to your C:\Windows\SysWOW64 folder as well (if you have a 64-bit operating system).

现在尝试在 Python 中运行您的代码文件,它会在几秒钟内加载图表。

【讨论】:

  • 在我的系统 Windows 7 中,Python 3.6.1 和 Oracle 11.2.0.3.0 是 64 位的。我有以下内容 - 1. 从网上下载 msvcp71.dll 和 msvcr71.dll。 2. 将它们保存到您的 C:\Windows\System32 文件夹。 3. 将它们保存到您的 C:\Windows\SysWOW64 文件夹中 4. 下载 Instantclient-basic-nt-11.2.0.3.0.zip 并在环境变量 -> 系统变量 -> 路径中设置此路径。同样在同一目录中,我粘贴了 msvcr100.dll 文件 5. 下载并安装 cx_Oracle-5.3-11g.win-amd64-py3.6-2.exe 但仍然 import cx_Oracle 显示错误。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-02-15
  • 2014-04-19
  • 2018-03-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多