简体   繁体   中英

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:

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

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 ';' before '{' token error: command 'gcc' failed with exit status 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! thanks in advance.

I don't see a way around having the Python header files (which are part of python-devel package). 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.

Why are you reluctant to install 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:

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. The python package will also need to be installed. You'll probably also want to install the python-docs package, which contains Python documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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