在opensuse上安装pyodbc时出错

时间:2012-07-27 15:32:54

标签: python pyodbc opensuse

当我尝试使用“python setup.py build install”安装pyodbc时,它会显示如下错误:

gcc -pthread -fno-strict-aliasing -DNDEBUG -march = i586 -mtune = i686 -fmessage-length = 0 -O2 -Wall -D_FORTIFY_SOURCE = 2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fwrapv -fPIC -DPYODBC_VERSION = 3.0.3 -I / usr / include / python2.6 -c /root/Desktop/pyodbc-3.0.3/src/sqlwchar.cpp -o build / temp.linux-i686- 2.6 / root / Desktop / pyodbc-3.0.3 / src / sqlwchar.o -Wno-write-strings 在/root/Desktop/pyodbc-3.0.3/src/sqlwchar.cpp:2中包含的文件中: /root/Desktop/pyodbc-3.0.3/src/pyodbc.h:41:20:错误:Python.h:没有这样的文件或目录 /root/Desktop/pyodbc-3.0.3/src/pyodbc.h:42:25:错误:floatobject.h:没有这样的文件或目录 /root/Desktop/pyodbc-3.0.3/src/pyodbc.h:43:24:错误:longobject.h:没有这样的文件或目录 /root/Desktop/pyodbc-3.0.3/src/pyodbc.h:44:24:错误:boolobject.h:没有这样的文件或目录

还有更多具有类似反馈的行,在回复的最后是:

/root/Desktop/pyodbc-3.0.3/src/pyodbccompat.h:106:错误:在'{'令牌之前预期','或';' 错误:命令'gcc'失败,退出状态为1

我已经四处寻找解决方案,每个人都说要安装python-devel并且它会没问题,但是我在没有python-devel的64bit opensuse上工作了,但它在32位上没有用,我无法在互联网上的任何地方找到python2.6.0-8.12.2的正确版本...所以我很困惑,请帮忙!提前谢谢。

2 个答案:

答案 0 :(得分:2)

我没有看到Python头文件(它是python-devel包的一部分)的方法。他们需要编译包。

也许有一个64位版本的预编译蛋,这就是它的安装方式。

为什么你不愿意安装python-devel?

答案 1 :(得分:2)

error: Python.h: No such file or directory

我遇到了同样的错误,在安装了正确版本的python-devel之后就清除了,这个版本确实存在于64位:

rpm -qa | grep python-devel
python-devel-2.6.6-36.el6.x86_64
[root@lga-vertdev01 test]# rpm -qi python-devel
Name        : python-devel                 Relocations: (not relocatable)
Version     : 2.6.6                             Vendor: CentOS
Release     : 36.el6                        Build Date: Thu 21 Feb 2013 07:02:48 PM EST
Install Date: Tue 12 Mar 2013 08:00:53 AM EDT      Build Host: c6b9.bsys.dev.centos.org
Group       : Development/Libraries         Source RPM: python-2.6.6-36.el6.src.rpm
Size        : 466338                           License: Python
Signature   : RSA/SHA1, Sat 23 Feb 2013 12:39:13 PM EST, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem <http://bugs.centos.org>
URL         : http://www.python.org/
Summary     : The libraries and header files needed for Python development
Description :
The Python programming language's interpreter can be extended with
dynamically loaded extensions and can be embedded in other programs.
This package contains the header files and libraries needed to do
these types of tasks.

如果要开发Python扩展,请安装python-devel。该 还需要安装python包。你可能也会 想要安装包含Python的python-docs包 文档。