如何在unbuntu14.04上安装cx_oracle

时间:2015-03-13 17:21:31

标签: python cx-oracle

➜cx_oraclepython setup.py build

running build
running build_ext
building 'cx_Oracle' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/qk/Documents/instantclient_11_2 -I/usr/include/python2.7 -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-11g/cx_Oracle.o -DBUILD_VERSION=5.2
cx_Oracle.c:6:20: fatal error: Python.h: No such file or directory
 #include <Python.h>
                    ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
➜  cx_oracle  echo $ORACLE_HOME
/home/qk/Documents/instantclient_11_2
➜  cx_oracle  echo $DYLD_LIBRARY_PATH
/home/qk/Documents/instantclient_11_2
➜  cx_oracle  echo $LD_LIBRARY_PATH
/home/qk/Documents/instantclient_11_2
➜  cx_oracle  python
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more informat
顺便说一句,我用Anaconda切换了python2.7。看来python安装错了。

1 个答案:

答案 0 :(得分:4)

您需要安装python-dev包以便python标头可用:

sudo apt-get install python-dev