2017-10-24 10 views
0

파이썬 2.7.5와 파이썬 3.4.5를 모두 사용하고 있습니다. 하지만 파이썬 3.4.5와 함께 일하고있다pyodbc를 설치하거나 가져올 수 없습니다.

이 서버에는 두 명의 사용자가있다. 한 사용자가 문제없이 pyodbc를 가져올 수 있습니다. 다른 계정은 pyodbc 모듈에 액세스 할 수 없습니다. 다음은

-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' 

이 핍 버전입니다 시도가 pyodbc

pip3 install pyodbc==3.0.10 

패키지 아래

-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 

서버

012에 설치되어있는 오류 아래 얻기 설치

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

3,516,

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 

과 또한 내가 sudo는 권한 나는

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

답변

0

아래 얻고로 설치하려고 할 때 문제는 당신은 당신의 GCC (C++/C 컴파일러 누락

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

를 관련이없는 PIP하는 것입니다) 및 개발 도구 - 따라서 누락 된 C 헤더 파일

다음 YUM 그룹을 sati에 설치할 수 있습니다 SFY 요구 사항 :

레드햇/CentOS는 :

sudo yum group install "Development Tools" 

또는

sudo yum groupinstall "Development Tools" 
+0

-bash-4.2 $ 고양이의/etc/레드햇 릴리스 에 CentOS 리눅스 출시 7.0.1406 (코어) – Ravi

+0

시도 'yum install python3-dev' – AK47

+0

-bash-4.2 $ cat/etc/redhat-release CentOS 리눅스 릴리스 7.0.1406 (코어) 서버의 한 사용자가 pyodbc 모듈에 액세스 할 수 있지만 sudo를 사용하여 설치하려고 할 때 쇼에서 다음과 같이 sudo pip3 install pyodbc == 3.0.10 요구 사항을 이미 만족 함 : pyodbc == 3.0.10 in /export/home/python/lib/python3.4/site-packages – Ravi