我尝试连接我的 Oracle 数据库,但出现错误。我是 python 的初学者,我尝试在文档中找到答案,但这对我来说很难。
Python version :
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32
Oracle version :
11.2.0.1.0
我的鳕鱼很简单:
from sqlalchemy import create_engine
import cx_Oracle
engine = create_engine('oracle://user:[email protected]:port/SID')
result = engine.execute('select * FROM TABLE')
结果我得到一个错误:
Exception has occurred: DatabaseError
(cx_Oracle.DatabaseError) DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found".
Python
cx_Oracle
库依赖于 Oracle Client library
。
从此处下载 Oracle 客户端库:https://www.oracle.com/database/technologies/instant-client.html
祝你好运!
看起来库没有正确安装。 参考 cx_Oracle 错误。 DPI-1047:无法找到 64 位 Oracle 客户端库
安装cx_Oracle
python -m pip install cx_Oracle --upgrade