使用pip安装cx_Oracle

时间:2017-02-28 17:26:07

标签: python-3.x pip cx-oracle

我试图通过发出命令pip通过pip install cx_Oracle安装cx_Oracle但是我收到此错误:

Collecting cx_Oracle
  Downloading cx_Oracle-5.2.1.tar.gz (113kB)
    100% |████████████████████████████████| 122kB 141kB/s 
Building wheels for collected packages: cx-Oracle
  Running setup.py bdist_wheel for cx-Oracle ... error
  Complete output from command /home/srseven/Documents/test/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yrq51gn9/cx-Oracle/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpfd_b54rwpip-wheel- --python-tag cp34:
  running bdist_wheel
  running build
  running build_ext
  building 'cx_Oracle' extension
  creating build
  creating build/temp.linux-x86_64-3.4-11g
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/u01/app/oracle/product/11.2.0/xe/rdbms/demo -I/u01/app/oracle/product/11.2.0/xe/rdbms/public -I/usr/include/python3.4m -I/home/srseven/Documents/test/include/python3.4m -c cx_Oracle.c -o build/temp.linux-x86_64-3.4-11g/cx_Oracle.o -DBUILD_VERSION=5.2.1
  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

  ----------------------------------------
  Failed building wheel for cx-Oracle
  Running setup.py clean for cx-Oracle
Failed to build cx-Oracle
Installing collected packages: cx-Oracle
  Running setup.py install for cx-Oracle ... error
    Complete output from command /home/srseven/Documents/test/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yrq51gn9/cx-Oracle/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-k79o78ca-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/srseven/Documents/test/include/site/python3.4/cx-Oracle:
    running install
    running build
    running build_ext
    building 'cx_Oracle' extension
    creating build
    creating build/temp.linux-x86_64-3.4-11g
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/u01/app/oracle/product/11.2.0/xe/rdbms/demo -I/u01/app/oracle/product/11.2.0/xe/rdbms/public -I/usr/include/python3.4m -I/home/srseven/Documents/test/include/python3.4m -c cx_Oracle.c -o build/temp.linux-x86_64-3.4-11g/cx_Oracle.o -DBUILD_VERSION=5.2.1
    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

    ----------------------------------------
Command "/home/srseven/Documents/test/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yrq51gn9/cx-Oracle/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-k79o78ca-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/srseven/Documents/test/include/site/python3.4/cx-Oracle" failed with error code 1 in /tmp/pip-build-yrq51gn9/cx-Oracle/

如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您需要在计算机上安装Python开发包。这通常称为python3-devel,但根据您的平台可能会有所不同。

相关问题