简体   繁体   中英

gcc error when installing pyodbc

I am installing pyodbc on Redhat 6.5. Python 2.6 and 2.7.4 are installed. I get the following error below even though the header files needed for gcc are in the /usr/include/python2.6.

I have updated every dev package: yum groupinstall -y 'development tools'

Any ideas on how to resolve this issue would be greatly appreciated???

Installing pyodbc...
Processing ./pyodbc-3.0.10.tar.gz
Installing collected packages: pyodbc
Running setup.py install for pyodbc ... error
Complete output from command /opt/rh/python27/root/usr/bin/python -u -c "import setuptools, tokenize; file ='/tmp/pip-JAGZDD-build/setup.py';exec(compile(getattr(tokenize, 'open', open)( file ).read().replace('\\r\\n', '\\n'), file , 'exec'))" install --record /tmp/pip-QJasL0-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'pyodbc' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/tmp
creating build/temp.linux-x86_64-2.7/tmp/pip-JAGZDD-build
creating build/temp.linux-x86_64-2.7/tmp/pip-JAGZDD-build/src
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYODBC_VERSION=3.0.10 -DPYODBC_UNICODE_WIDTH=4 -DSQL_WCHART_CONVERT=1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -I/opt/rh/python27/root/usr/include/python2.7 -c /tmp/pip-JAGZDD-build/src/cnxninfo.cpp -o build/temp.linux-x86_64-2.7/tmp/pip-JAGZDD-build/src/cnxninfo.o -Wno-write-strings
In file included from /tmp/pip-JAGZDD-build/src/cnxninfo.cpp:8:
**

**/tmp/pip-JAGZDD-build/src/pyodbc.h:41:20: error: Python.h: No such file or directory
/tmp/pip-JAGZDD-build/src/pyodbc.h:42:25: error: floatobject.h: No such file or directory
/tmp/pip-JAGZDD-build/src/pyodbc.h:43:24: error: longobject.h: No such file or directory
/tmp/pip-JAGZDD-build/src/pyodbc.h:44:24: error: boolobject.h: No such file or directory
/tmp/pip-JAGZDD-build/src/pyodbc.h:45:27: error: unicodeobject.h: No such file or directory
/tmp/pip-JAGZDD-build/src/pyodbc.h:46:26: error: structmember.h: No such file or directory

** In file included from /tmp/pip-JAGZDD-build/src/pyodbc.h:137,
from /tmp/pip-JAGZDD-build/src/cnxninfo.cpp:8:
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:61:28: error: stringobject.h: No such file or directory
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:62:25: error: intobject.h: No such file or directory
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:63:28: error: bufferobject.h: No such file or directory
In file included from /tmp/pip-JAGZDD-build/src/cnxninfo.cpp:8:
/tmp/pip-JAGZDD-build/src/pyodbc.h: In function 'void _strlwr(char*)':
/tmp/pip-JAGZDD-build/src/pyodbc.h:92: error: 'tolower' was not declared in this scope
In file included from /tmp/pip-JAGZDD-build/src/pyodbc.h:137,
from /tmp/pip-JAGZDD-build/src/cnxninfo.cpp:8:
/tmp/pip-JAGZDD-build/src/pyodbccompat.h: At global scope:
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:71: error: expected initializer before '*' token
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:81: error: 'Text_Buffer' declared as an 'inline' variable
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:81: error: 'PyObject' was not declared in this scope
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:81: error: 'o' was not declared in this scope
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:82: error: expected ',' or ';' before '{' token
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:93: error: 'Text_Check' declared as an 'inline' variable
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:93: error: 'PyObject' was not declared in this scope
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:93: error: 'o' was not declared in this scope
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:94: error: expected ',' or ';' before '{' token
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:104: error: 'PyObject' was not declared in this scope
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:104: error: 'lhs' was not declared in this scope
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:104: error: expected primary-expression before 'const'
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:104: error: initializer expression list treated as compound expression
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:109: error: 'Text_Size' declared as an 'inline' variable
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:109: error: 'PyObject' was not declared in this scope
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:109: error: 'o' was not declared in this scope
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:110: error: expected ',' or ';' before '{' token
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:118: error: 'TextCopyToUnicode' declared as an 'inline' variable
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:118: error: 'Py_UNICODE' was not declared in this scope
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:118: error: 'buffer' was not declared in this scope
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:118: error: 'PyObject' was not declared in this scope
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:118: error: 'o' was not declared in this scope
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:118: error: initializer expression list treated as compound expression
/tmp/pip-JAGZDD-build/src/pyodbccompat.h:119: error: expected ',' or ';' before '{' token
error: command 'gcc' failed with exit status 1

解决方法是重新安装Python2.7

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