- 问题描述
一个包含cx_Oracle的python文件,直接在linux下使用python命令可以运行,但是设置crontab定时任务会报错如下:
cx_Oracle.DatabaseError:
DPI-1047: 64-bit Oracle Client library cannot be loaded:
"libclntsh.so: cannot open shared object file: No such file or directory".
See https://oracle.github.io/odpi/doc/installation.html#linux for help
- 出现原因
crontab独立环境变量,找不到oracle相关的库 - 解决方案
- 找到能够正常运行文件的环境变量内容:
这里我用的
cat ~/.bash_profile
里面一般包含包括PATH/ORACLE_HOME/LD_LIBRARY_PATH之类的(下面的path仅作参考,到时候大家记得换成自己的path)
PATH=<