当我在Pycharm IDE中运行我的test.py时,我不能解决这个问题,我之前被配置为使用Vagrant机器,并且我得到这个错误。我在那里使用Virtual Env。奇怪的是,当我通过ssh (python test.py)将它手动运行到我的机器上时,却没有出现问题。
下面是test.py的代码:
import cx_Oracle
host = '10.210.1.15'
port = 1521
sid = 'ORCL'
user = 'repdb'
password = 'rep1'
sql = 'select id from db.device_group dg'
dsn = cx_Oracle.makedsn(host, port,sid)
conn = cx_Oracle.connect(user, password, dsn)
cur = conn.cursor()
cur.execute(sql)
data = cur.fetchall()
print(data)发布于 2018-02-07 23:43:52
请查看here中最近增强的安装文档。根据您的描述,您的Vagrant/venv环境中似乎缺少某些配置。
https://stackoverflow.com/questions/48636413
复制相似问题