2017-05-05 118 views
0

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

我从https://oracle.github.io/python-cx_Oracle/ 的代码安装cx_Oracle是如下 -

import cx_Oracle 

con = cx_Oracle.connect('sde/[email protected]') 
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 

请让我知道的步骤连接的Python 3.6.1和用于Windows-7 64位的Oracle 11g。

+0

你用pip安装了它还是下载了它? – Exprator

+0

我已经安装了cx_Oracle-5.3-11g.win-amd64-py3.6-2.exe(md5)。 – Kuladip

+0

使用pip install cx_Oracle并尝试。希望它能解决这个错误 – Exprator

回答

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中运行您的代码文件,它会在几秒钟内加载图形。

+0

在我的系统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 但仍然导入cx_Oracle显示错误。 – Kuladip