【发布时间】:2021-08-09 21:51:09
【问题描述】:
我需要在 PCF 中部署我的 python API,但在部署时遇到访问 cx_Oracle 库的问题。
到目前为止我已经完成的步骤:-
- 将 Oracle Instant Client(Linux) 解压缩到我的项目下名为“oracle”的文件夹中。
- 将这些添加到 .profile
LD_LIBRARY_PATH=/c/Documents/project_name/oracle/instantclient_21_1:${LD_LIBRARY_PATH:-}
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/c/Documents/project_name/oracle/instantclient_21_1
export OCI_LIB_DIR=/c/Documents/project_name/oracle/instantclient_21_1
export OCI_INC_DIR=/c/Documents/project_name/oracle/instantclient_21_1/sdk/include
即使在此之后,我仍然收到以下错误:
“DPI-1047:找不到 64 位 Oracle 客户端库:“libclntsh.so:无法打开共享对象文件:没有这样的文件或目录”。请参阅 https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html 寻求帮助”
【问题讨论】:
-
检查 stackoverflow.com/questions/66781781/… 中的 cmets。旁注:删除 OCI_*_DIR 变量 - cx_Oracle 或 Oracle Instant Client 不使用它们。
-
如果您使用
/c/Documents/project_name作为提取的 Oracle 客户端文件的路径,这是不正确的。应该是/home/vcap/app/oracle/...。您的应用程序文件在 CF 上的容器中提取时将存在于/home/vcap/app下。或者使用$HOME,它也指向你的应用文件。
标签: python python-3.x oracle cloud-foundry