我正在研究AWS胶水pythonshell。我想把pythonshell和Oracle连接起来。我成功地安装了psycopg2和mysql库,但是当我试图使用cx_Oracle连接Oracle时,我已经成功地安装了库,但是我遇到了错误DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library:
"libclntsh.so: cannot open shared object file: No such file or
directory"
我已经试过了我从S3下载了so文件,并将其与代码文件并行地放在lib文件夹中
我已经设置了LD_LIBRARY_路径,ORACLE\u HOME使用操作系统环境
我使用以下代码import boto3
import os
import sys
import site
from setuptools.command import easy_install
s3 = boto3.client('s3')
dir_path = os.path.dirname(os.path.realpath(__file__))
#os.path.dirname(sys.modules['__main__'].__file__)
install_path = os.environ['GLUE_INSTALLATION']
easy_install.main( ["--install-dir", install_path, "cx_Oracle"] )
importlib.reload(site)
import cx_Oracle
conn_str = u'{username}/{password}@{host}:{port}/{sid}'
conn = cx_Oracle.connect(conn_str)
c = conn.cursor()
c.execute(u'select * from hr.countries')
for row in c:
print(row[0], "-", row[1])
conn.close()
print('hello I am here');
我应该能够在aws glue pythonshell上连接oracle