* 背景
flask框架,使用sqlalchemy连接oracle
使用cx_oracle连接
* 问题
使用库连接的时候报错。报错信息如下:
File "build/bdist.macosx-10.11-intel/egg/cx_Oracle.py", line 7, in <module>
File "build/bdist.macosx-10.11-intel/egg/cx_Oracle.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/yinghaiyun/.python-eggs/cx_Oracle-5.2.1-py2.7-macosx-10.11-intel.egg-tmp/cx_Oracle.so, 2): Library not loaded: /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1
Referenced from: /Users/yinghaiyun/.python-eggs/cx_Oracle-5.2.1-py2.7-macosx-10.11-intel.egg-tmp/cx_Oracle.so
How is cx_Oracle installed? Is it compiled and installed with pip? Looking at your stack, it should be that libclntsh.dylib.11.1, which cx_Oracle.so depends on, was not loaded successfully. Are you a Mac? As I said before, the problem is that cx_Oracle.so itself also depends on other dynamic libraries. You need to ensure Other dynamic library versions are consistent with its requirements and can be loaded normally. Mac does not have them today. Please take a look at the dependencies under Linux.
The command corresponding to ldd under Mac is otool (http://blog.sina.com.cn/s/blog_630c58cb0...
For the record, there is no problem and it can be executed when executing python -c "import cx_Oracle" in the virtual environment. But there will be problems when executing it in pycharm. I am still looking for the problem