python setup.py egg_info gcc错误安装cassandra python

时间:2016-01-20 20:48:51

标签: python 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

于是尝试了全新安装的python,然后尝试更新并安装设置工具

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

完整的堆栈跟踪

[root@d8174406546b 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 个答案:

答案 0 :(得分: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

答案 1 :(得分:0)

我在码头工作,所以前缀为&#39; RUN&#39;。在实际系统上,您将需要使用sudo代替RUN。有时,点子是工具旧的。在我的情况下它是7.x所以我也升级了它。 cython取决于python-devel

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