我尝试连接Oracle数据库,但Python脚本无法找到cx_Oracle。以下是我的脚本:
import cx_Oracle
con = cx_Oracle.connect(‘DBNAME/testitout@www.xx.yy.zz:1521/yeppers’)
print(con.version)
con.close()
我遇到了以下错误:
================= RESTART: C:\Python35\Connect_To_Oracle.py =================
Traceback (most recent call last):
File "C:\Python35\Connect_To_Oracle.py", line 1, in <module>
import cx_Oracle
cx_Oracle.DatabaseError: DPI-1047: Oracle Client library cannot be loaded: The specified module could not be found. See https://oracle.github.io/odpi/doc/installation.html for help
以下是我的操作系统和版本信息:
- Intel Xeon CPU E7-4870 @ 2.40GHz
- Windows Server 2008 R2 Enterprise
- Python 3.5
以下是我安装 cx_Oracle 的步骤:
1. Download Instant Client (Basic Client) from Oracle here : http://www.oracle.com/technetwork/topics/winx64soft-089540.html .
2. Unzip.
3. I added a new System Variable called ORACLE_HOME and pointed it to c:\Down\InstantClient , which is where I unzipped the above. This is what I downloaded: instantclient-basic-windows.x64-12.2.0.1.0
4. You have to download the whl file from here: https://pypi.python.org/pypi/cx_Oracle/ To do this, you need to know your version of Python and your type of processor.
5. You download into the scripts folder and then run pip install wheelfilename.whl
能否有人告诉我,他们认为这个错误的来源是什么?