2017-10-24 2 views
0

Ich benutze sowohl Python Python 2.7.5 und Python 3.4.5. aber ich arbeite mit Python 3.4.5kann nicht installieren oder importieren pyodbc

Es gibt zwei Benutzer auf diesem Server. Ein Benutzer kann pyodbc ohne Probleme importieren. aber andere Konto nicht auf pyodbc Modul zugreifen.

-bash-4.2$ python3 
Python 3.4.5 (default, May 29 2017, 15:17:55) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import pyodbc 
Traceback (most recent call last): 
File "<stdin>", line 1, in <module> 
ImportError: No module named 'pyodbc' 

Im Folgenden finden Sie pip Version

-bash-4.2$ pip3 -V 
pip 9.0.1 from /<path to lcaotion>/.local/lib/python3.4/site-packages 
(python 3.4) 

wenn Versuch Pyodbc

pip3 install pyodbc==3.0.10 

Erste unten Fehler

-bash-4.2$ pip3 install pyodbc==3.0.10 
    Collecting pyodbc==3.0.10 
    Using cached pyodbc-3.0.10.tar.gz 
    Installing collected packages: pyodbc 
    Running setup.py install for pyodbc ... error 
    Complete output from command /usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yygzbf28/pyodbc/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-4w_3g87z-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-3.4 
creating build/temp.linux-x86_64-3.4/tmp 
creating build/temp.linux-x86_64-3.4/tmp/pip-build-yygzbf28 
creating build/temp.linux-x86_64-3.4/tmp/pip-build-yygzbf28/pyodbc 
creating build/temp.linux-x86_64-3.4/tmp/pip-build-yygzbf28/pyodbc/src 
gcc -pthread -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -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/usr/include/python3.4m -c /tmp/pip-build-yygzbf28/pyodbc/src/buffer.cpp -o build/temp.linux-x86_64-3.4/tmp/pip-build-yygzbf28/pyodbc/src/buffer.o -Wno-write-strings 
In file included from /tmp/pip-build-yygzbf28/pyodbc/src/buffer.cpp:12:0: 
/tmp/pip-build-yygzbf28/pyodbc/src/pyodbc.h:41:20: fatal error: Python.h: No such file or directory 
#include <Python.h> 
        ^
compilation terminated. 
error: command 'gcc' failed with exit status 1 

Below-Pakete in Server

012 installiert sind, installieren
dbus-python.x86_64 
libselinux-python.x86_64 
newt-python.x86_64 
python.x86_64 
python-backports.noarch 
python-backports-ssl_match_hostname.noarch 
python-configobj.noarch 
python-configshell.noarch 
python-decorator.noarch 
python-devel.x86_64 
python-ethtool.x86_64 
python-iniparse.noarch 
python-kmod.x86_64 
python-libs.x86_64 
python-pcp.x86_64 
python-pycurl.x86_64 
python-pyudev.noarch 
python-rtslib.noarch 
python-setuptools.noarch 
python-slip.noarch 
python-slip-dbus.noarch 
python-urlgrabber.noarch 
python-urwid.x86_64 
python2-crypto.x86_64 
python34.x86_64 
python34-libs.x86_64 
python34-pip.noarch 
python34-setuptools.noarch 
rpm-python.x86_64 

, und auch wenn ich als sudo Erlaubnis zu installieren versucht, erhalte ich unter

sudo pip3 install pyodbc==3.0.10 
Requirement already satisfied: pyodbc==3.0.10 in 
/export/home/python/lib/python3.4/site-packages 

Antwort

0

Die Frage in keinem Zusammenhang wird

fatal error: Python.h: No such file or directory

Sie vermissen Ihr GCC (C++/C-Compiler PIP) und Entwicklungstools von Ihrer Maschine - daher die fehlende C-Header-Datei

Sie können die folgenden YUM-Gruppe zu sati installieren SFY die Forderung:

RedHat/CentOS:

sudo yum group install "Development Tools" 

oder

sudo yum groupinstall "Development Tools" 
+0

-bash-4.2 $ cat/etc/redhat-release CentOS Linux-Version 7.0.1406 (Core) – Ravi

+0

Try 'yum install python3-dev' – AK47

+0

-bash-4.2 $ cat/etc/redhat-release CentOS Linux Release 7.0.1406 (Core) aber ein Benutzer im Server kann auf das pyodbc-Modul zugreifen, aber wenn ich versuche, mit sudo zu installieren in Shows wie unten sudo pip3 install pyodbc == 3.0.10 Anforderung bereits erfüllt: pyodbc == 3.0.10 in /export/home/python/lib/python3.4/site-packages – Ravi

Verwandte Themen