接受这个问题的答案How to install/use cx_Oracle in PyPy说,为了在 pypy 上安装 cx_Oracle,我需要用--withmod-oracle
参数编译它。如果我这样做,我将获得 cx_Oracle v. 5.0.0:
Python 2.7.3 (5acfe049a5b0cd0de158f62553a98f5ef364fd29, Jul 02 2013, 20:33:21)
[PyPy 2.0.2 with GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``the way to avoid a workaround is
to introduce a stronger workaround somewhere else''
>>>> import cx_Oracle
>>>> cx_Oracle.version
'5.0.0'
不幸的是,django 不会运行它,因为没有 NCLOB:
./manage.py shell
File "/home/user/.virtualenvs/pypy_chembl_migration/site-packages/django/db/backends/oracle/introspection.py", line 13, in DatabaseIntrospection
cx_Oracle.NCLOB: 'TextField',
AttributeError: 'module' object has no attribute 'NCLOB'
我需要的是 cx_Oracle,版本 5.1.2。我怎么才能得到它?
Pypy wiki ( https://bitbucket.org/pypy/compatibility/wiki/cx_oracle ) 说 cx_Oracle 可以使用它。但我想我从那句话中得出了错误的结论:
pip install cx_Oracle -U
Downloading/unpacking cx-Oracle
Running setup.py egg_info for package cx-Oracle
...
cc -O2 -fPIC -Wimplicit -I/usr/include/oracle/11.2/client64 -I/home/user/.virtualenvs/pypy_chembl_migration/include -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-11g/cx_Oracle.o -DBUILD_VERSION=5.1.2
In file included from Variable.c:162:0,
from Cursor.c:236,
from Connection.c:775,
from SessionPool.c:139,
from cx_Oracle.c:198:
IntervalVar.c: In function ‘IntervalVar_SetValue’:
IntervalVar.c:135:24: error: ‘PyDateTime_Delta’ has no member named ‘seconds’
IntervalVar.c:136:20: error: ‘PyDateTime_Delta’ has no member named ‘seconds’
IntervalVar.c:140:49: error: ‘PyDateTime_Delta’ has no member named ‘days’
IntervalVar.c:141:27: error: ‘PyDateTime_Delta’ has no member named ‘microseconds’
In file included from cx_Oracle.c:198:0:
SessionPool.c: In function ‘SessionPool_Init’:
SessionPool.c:200:5: warning: passing argument 1 of ‘PyType_Check’ from incompatible pointer type [enabled by default]
/home/user/.virtualenvs/pypy_chembl_migration/include/pypy_decl.h:405:17: note: expected ‘struct PyObject *’ but argument is of type ‘struct PyTypeObject *’
error: command 'cc' failed with exit status 1