2016-01-20 164 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