Python 3.x 使用pip安装cx_Oracle

Python 3.x 使用pip安装cx_Oracle,python-3.x,pip,cx-oracle,Python 3.x,Pip,Cx Oracle,我试图通过发出命令pip install cx\u Oracle通过pip安装cx\u Oracle安装cx\u Oracle,但出现以下错误: Collecting cx_Oracle Downloading cx_Oracle-5.2.1.tar.gz (113kB) 100% |████████████████████████████████| 122kB 141kB/s Building wheels for collected packages: cx-Oracle

我试图通过发出命令
pip install cx\u Oracle
通过
pip安装cx\u Oracle
安装cx\u 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/
收集cx\u Oracle
下载cx_Oracle-5.2.1.tar.gz(113kB)
100% |████████████████████████████████| 122kB 141kB/s
为收集的软件包构建控制盘:cx Oracle
正在为cx Oracle运行setup.py bdist\u控制盘。。。错误
从命令/home/srseven/Documents/test/bin/python3.4-u-c“导入setuptools,tokenize;uu file_uuu=”/tmp/pip-build-yrq51gn9/cx-Oracle/setup.py';f=getattr(tokenize,'open',open)(uu文件u);code=f.read().替换('\r\n','n');f.close();exec(编译(代码,'uu文件,'exec'))bdist_-wheel-d/tmp/tmpfd_b54rwpip-wheel---python标记cp34:
运转的车轮
运行构建
运行build_ext
构建“cx_Oracle”扩展
创建构建
创建build/temp.linux-x86_64-3.4-11g
x86_64-linux-gnu-gcc-pthread-DNDEBUG-g-fwrapv-O2-Wall-Wstrict原型-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:致命错误:Python.h:没有这样的文件或目录
#包括
^
编译终止。
错误:命令“x86_64-linux-gnu-gcc”失败,退出状态为1
----------------------------------------
为cx Oracle构建控制盘失败
为cx Oracle运行setup.py clean
无法生成cx Oracle
安装收集的软件包:cx Oracle
正在为cx Oracle运行setup.py安装。。。错误
从命令/home/srseven/Documents/test/bin/python3.4-u-c“导入setuptools,tokenize;uu file_uuu=”/tmp/pip-build-yrq51gn9/cx-Oracle/setup.py';f=getattr(tokenize,'open',open)(uu文件u);code=f.read().替换('\r\n','n');f.close();exec(编译(代码,'uu文件,'exec'))安装--record/tmp/pip-k79o78ca-record/install-record.txt--外部管理的单一版本--编译--install headers/home/srseven/Documents/test/include/site/python3.4/cx-Oracle:
正在运行的安装
运行构建
运行build_ext
构建“cx_Oracle”扩展
创建构建
创建build/temp.linux-x86_64-3.4-11g
x86_64-linux-gnu-gcc-pthread-DNDEBUG-g-fwrapv-O2-Wall-Wstrict原型-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:致命错误:Python.h:没有这样的文件或目录
#包括
^
编译终止。
错误:命令“x86_64-linux-gnu-gcc”失败,退出状态为1
----------------------------------------
命令“/home/srseven/Documents/test/bin/python3.4-u-c”导入setuptools,标记化__文件_uu='/tmp/pip-build-yrq51gn9/cx-Oracle/setup.py';f=getattr(标记化“打开”,打开)(_文件);code=f.read().replace('\r\n','\n');f、 close();exec(compile(code,_ufile,_u,'exec'))“安装--record/tmp/pip-k79o78ca-record/install-record.txt--外部管理的单一版本--编译--install headers/home/srseven/Documents/test/include/site/python3.4/cx Oracle”失败,错误代码为1,出现在/tmp/pip-build-yrq51gn9/cx-Oracle中/

如何解决此问题?

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

事实上,这是我的Ubuntu 14.04系统的python3-dev。