2016-01-20 200 views
1

出於某種原因,我需要手動安裝的特定版本不能直接訪問:蟒蛇setup.py egg_info GCC錯誤安裝卡桑德拉蟒蛇

rpm -i ftp://195.220.108.108/linux/centos/7.1.1503/updates/x86_64/Packages/python-2.7.5-18.el7_1.1.x86_64.rpm 

所以試圖蟒蛇的全新安裝,然後試圖更新和安裝設置工具

yum -y update 
yum -y install python-pip 
pip install -U pip 
pip install -U setuptools 
pip install cassandra-driver 
yum install patch 

然後試圖

wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py 
    python ez_setup.py 
    pip install cassandra-driver 

完整堆棧跟蹤

[[email protected] cassandradump]# pip install cassandra-driver 
Collecting cassandra-driver 
/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject 
Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validat 
ion failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. 
    SNIMissingWarning 
/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. Thi 
s prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/e 
n/latest/security.html#insecureplatformwarning. 
    InsecurePlatformWarning 
    Using cached cassandra-driver-3.0.0.tar.gz 
    Complete output from command python setup.py egg_info: 
    warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests' 
    warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests' 
    warning: no files found matching '*.h' under directory 'Cython/Debugger/Tests' 
    warning: no files found matching '*.pxd' under directory 'Cython/Utility' 
    unable to execute gcc: No such file or directory 
    Unable to find pgen, not compiling formal grammar. 
    Traceback (most recent call last): 
     File "<string>", line 1, in <module> 
     File "/tmp/pip-build-cP9FYQ/cassandra-driver/setup.py", line 375, in <module> 
     run_setup(None) 
     File "/tmp/pip-build-cP9FYQ/cassandra-driver/setup.py", line 373, in run_setup 
     **kw) 
     File "/usr/lib64/python2.7/distutils/core.py", line 112, in setup 
     _setup_distribution = dist = klass(attrs) 
     File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 269, in __init__ 
     self.fetch_build_eggs(attrs['setup_requires']) 
     File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 313, in fetch_build_eggs 
     replace_conflicting=True, 
     File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 827, in resolve 
     dist = best[req.key] = env.best_match(req, ws, installer) 
     File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1072, in best_match 
     return self.obtain(req, installer) 
     File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1084, in obtain 
     return installer(requirement) 
     File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 380, in fetch_build_egg 
     return cmd.easy_install(req) 
     File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 640, in easy_install 
     return self.install_item(spec, dist.location, tmpdir, deps) 
     File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 670, in install_item 
     dists = self.install_eggs(spec, download, tmpdir) 
     File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 853, in install_eggs 
     return self.build_and_install(setup_script, setup_base) 
     File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1081, in build_and_install 
     self.run_setup(setup_script, setup_base, args) 
     File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1069, in run_setup 
     raise DistutilsError("Setup script exited with %s" % (v.args[0],)) 
    distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1 

    ---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-cP9FYQ/cassandra-driver 

回答

2

類型化進入太早,錯過了GCC庫,並得到了由類似的帖子帶走。

/tmp/easy_install-N19BCp/Cython-0.23.4/Cython/Plex/Scanners.c:4:20: fatal error: Python.h: No such file or directory 
#include "Python.h" 
        ^
compilation terminated. 
Unable to find pgen, not compiling formal grammar. 
Traceback (most recent call last): 

然後python-devel解決了這個問題。

install yum install python-devel 
0

我在docker裏工作,所以在'RUN'前加上了前綴。在真實系統中,您需要使用sudo代替RUN。有時候,這個點是舊的。在我的情況下,它是7.x,所以我也升級了它。 cython取決於python-devel

RUN pip install --upgrade pip 
RUN yum -y install python-devel 
RUN pip install cython