環境:django 1.8.7,python 2.7,cx_Oracle 6.1 ,oracle 11.2
最近在liunx服務器上安裝了cx_Oracle,默認給我裝了6.1版本,結果測試起來各種異常,先是單獨寫個py文件測試連接oracle,報
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
這個是由於沒安裝oracle客戶端引起,下個oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm安裝,修改環境變量解決,百度也有各種例子,不細說
然後整合django去操作oracle庫,報
cx_Oracle.Cursor no attribute 'numbersAsStrings'
國內碰到的人少,只能google去了,看到一句
The cursor attribute
numbersAsStrings
is deprecated and will be removed in cx_Oracle 6. An output type handler should be used instead.
意思是cx_Oracle 6.0中刪除numbersAsStrings方法,既然6.0刪除了,那我降級試試呢?於是
pip uninstall cx-oracle
pip install cx-oracle==5.2
問題解決