几个月前,我使用了一个docker文件,其中(1)使用基本的ubuntu映像,(2)安装miniconda python发行版,(3)使用miniconda安装一些python库,(4)运行以下命令为python设置cassandra-driver。
RUN pip install --upgrade pip
RUN pip install cassandra-driver
这在六个月前完美地完成了。但是现在我得到了这个例外。
Step 13 : RUN pip install cassandra-driver
---> Running in ba9955650d7c
Collecting cassandra-driver
Downloading cassandra-driver-3.0.0.tar.gz (186kB)
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 20, in <module>
File "/tmp/pip-build-0XzsPv/cassandra-driver/setup.py", line 375, in <module>
run_setup(None)
File "/tmp/pip-build-0XzsPv/cassandra-driver/setup.py", line 373, in run_setup
**kw)
File "/miniconda/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/dist.py", line 268, in __init__
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/dist.py", line 312, in fetch_build_eggs
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/__init__.py", line 846, in resolve
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/__init__.py", line 1091, in best_match
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/__init__.py", line 1103, in obtain
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/dist.py", line 379, in fetch_build_egg
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/command/easy_install.py", line 639, in easy_install
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/command/easy_install.py", line 669, in install_item
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/command/easy_install.py", line 852, in install_eggs
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/command/easy_install.py", line 1080, in build_and_install
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/command/easy_install.py", line 1068, in run_setup
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-0XzsPv/cassandra-driver
The command '/bin/sh -c pip install cassandra-driver' returned a non-zero code: 1
可能出什么问题了?安装软件包是否损坏或我做错了?
从2.7.0版开始,python cassandra-driver现在默认使用Cython扩展,但是对于那些无法轻松访问cython发行版或不需要cython发行版的人来说,这是一个逃生舱口,这可能是您的一个不错的选择也一样 cython扩展确实为性能带来了好处,但它可能不适用于许多情况(尤其是在您不进行高吞吐量的情况下)。
从安装文档中:
默认情况下,此程序包使用Cython来优化核心模块并构建自定义扩展。这不是一个硬性要求,但是默认情况下会使用它来构建提供比纯Python实现更好的性能的扩展。
使用构建开关或环境变量可以避免此构建阶段:
python setup.py install --no-cython
-or-
pip install --install-option="--no-cython" <spec-or-path>
另外,无论上下文如何,都可以使用环境变量来切换此选项:
CASS_DRIVER_NO_CYTHON=1 <your script here>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句