简体   繁体   English

在opensuse上安装pyodbc时出错

[英]Error when installing pyodbc on opensuse

when I try to install the pyodbc by using "python setup.py build install", it shows up with some errors like the following: 当我尝试使用“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 In file included from /root/Desktop/pyodbc-3.0.3/src/sqlwchar.cpp:2: /root/Desktop/pyodbc-3.0.3/src/pyodbc.h:41:20: error: Python.h: No such file or directory /root/Desktop/pyodbc-3.0.3/src/pyodbc.h:42:25: error: floatobject.h: No such file or directory /root/Desktop/pyodbc-3.0.3/src/pyodbc.h:43:24: error: longobject.h: No such file or directory /root/Desktop/pyodbc-3.0.3/src/pyodbc.h:44:24: error: boolobject.h: No such file or directory 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:没有这样的文件或目录

and few more lines with similar feedback, in the end of the reply is like: 还有更多具有类似反馈的行,在回复的最后是:

/root/Desktop/pyodbc-3.0.3/src/pyodbccompat.h:106: error: expected ',' or ';' /root/Desktop/pyodbc-3.0.3/src/pyodbccompat.h:106:错误:预期','或';' before '{' token error: command 'gcc' failed with exit status 1 在'{'令牌错误之前:命令'gcc'失败,退出状态为1

and I have searched around for the solutions, everyone says to install python-devel and it will be fine, but I got this working on a 64bit opensuse without the python-devel,but it doesn't work on the 32bit one, and I couldn't found the right version for python2.6.0-8.12.2 anywhere on the internet... so I'm quite confused, please help! 我一直在寻找解决方案,每个人都说要安装python-devel,它会很好,但是我在没有python-devel的64bit opensuse上工作了,但它在32bit上没有用,而且我无法在互联网上的任何地方找到python2.6.0-8.12.2的正确版本...所以我很困惑,请帮忙! thanks in advance. 提前致谢。

I don't see a way around having the Python header files (which are part of python-devel package). 我没有看到Python头文件(它是python-devel包的一部分)的方法。 They are required to compile the package. 他们需要编译包。

Maybe there was a pre-compiled egg for the 64bit version somewhere, and this is how it got installed. 也许有一个64位版本的预编译蛋,这就是它的安装方式。

Why are you reluctant to install python-devel? 你为什么不愿意安装python-devel?

error: Python.h: No such file or directory

I encountered the same error, which cleared after installing the correct version of python-devel, which does exist for 64bit: 我遇到了同样的错误,在安装了正确版本的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.

Install python-devel if you want to develop Python extensions. 如果要开发Python扩展,请安装python-devel。 The python package will also need to be installed. 还需要安装python包。 You'll probably also want to install the python-docs package, which contains Python documentation. 您可能还想安装python-docs包,其中包含Python文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM