pip install pyhs2 error: command 'gcc' failed with exit status 1

pip install pyhs2 error: command 'gcc' failed with exit status 1

我在Centos 6.9 虚拟机中使用Python 2.6.6 和pip 版本7.1.0(公司控制所以我不能做太多升级)。

是否有任何方法可以解决以下错误?

Collecting pyhs2
  Using cached pyhs2-0.6.0.tar.gz
Collecting sasl (from pyhs2)
  Using cached sasl-0.2.1.tar.gz
Requirement already satisfied: thrift in /usr/lib/python2.6/site-packages/thrift-0.11.0-py2.6.egg (from pyhs2)
Requirement already satisfied: six in /usr/lib/python2.6/site-packages/six-1.11.0-py2.6.egg (from sasl->pyhs2)
Installing collected packages: sasl, pyhs2
  Running setup.py install for sasl ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yp38hD/sasl/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-LVlbdm-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.6
    creating build/lib.linux-x86_64-2.6/sasl
    copying sasl/__init__.py -> build/lib.linux-x86_64-2.6/sasl
    running egg_info
    writing requirements to sasl.egg-info/requires.txt
    writing sasl.egg-info/PKG-INFO
    writing top-level names to sasl.egg-info/top_level.txt
    writing dependency_links to sasl.egg-info/dependency_links.txt
    warning: manifest_maker: standard file '-c' not found
    reading manifest file 'sasl.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'sasl.egg-info/SOURCES.txt'
    copying sasl/saslwrapper.cpp -> build/lib.linux-x86_64-2.6/sasl
    copying sasl/saslwrapper.h -> build/lib.linux-x86_64-2.6/sasl
    copying sasl/saslwrapper.pyx -> build/lib.linux-x86_64-2.6/sasl
    running build_ext
    building 'sasl.saslwrapper' extension
    creating build/temp.linux-x86_64-2.6
    creating build/temp.linux-x86_64-2.6/sasl
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Isasl -I/usr/include/python2.6 -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-2.6/sasl/saslwrapper.o
    In file included from sasl/saslwrapper.cpp:254:
    sasl/saslwrapper.h:22:23: error: sasl/sasl.h: No such file or directory
    In file included from sasl/saslwrapper.cpp:254:
    sasl/saslwrapper.h:145: error: ‘sasl_interact_t’ has not been declared
    sasl/saslwrapper.h:148: error: ‘sasl_conn_t’ has not been declared
    sasl/saslwrapper.h:148: error: ‘sasl_secret_t’ has not been declared
    sasl/saslwrapper.h:151: error: ISO C++ forbids declaration of ‘sasl_conn_t’ with no type
    sasl/saslwrapper.h:151: error: expected ‘;’ before ‘*’ token
    sasl/saslwrapper.h:152: error: ‘sasl_callback_t’ does not name a type
    sasl/saslwrapper.h:165: error: ISO C++ forbids declaration of ‘sasl_secret_t’ with no type
    sasl/saslwrapper.h:165: error: expected ‘;’ before ‘*’ token
    sasl/saslwrapper.h: In constructor ‘saslwrapper::ClientImpl::ClientImpl()’:
    sasl/saslwrapper.h:35: error: class ‘saslwrapper::ClientImpl’ does not have any field named ‘conn’
    sasl/saslwrapper.h:35: error: class ‘saslwrapper::ClientImpl’ does not have any field named ‘secret’
    sasl/saslwrapper.h: In destructor ‘saslwrapper::ClientImpl::~ClientImpl()’:
    sasl/saslwrapper.h:36: error: ‘conn’ was not declared in this scope
    sasl/saslwrapper.h:36: error: ‘sasl_dispose’ was not declared in this scope
    sasl/saslwrapper.h:36: error: ‘conn’ was not declared in this scope
    sasl/saslwrapper.h: In member function ‘void saslwrapper::ClientImpl::lastCallback()’:
    sasl/saslwrapper.h:143: error: ‘SASL_CB_LIST_END’ was not declared in this scope
    sasl/saslwrapper.h: In member function ‘bool saslwrapper::ClientImpl::init()’:
    sasl/saslwrapper.h:179: error: ‘sasl_client_init’ was not declared in this scope
    sasl/saslwrapper.h:180: error: ‘SASL_OK’ was not declared in this scope
    sasl/saslwrapper.h:181: error: ‘sasl_errstring’ was not declared in this scope
    sasl/saslwrapper.h:187: error: ‘SASL_CB_GETREALM’ was not declared in this scope
    sasl/saslwrapper.h:189: error: ‘SASL_CB_USER’ was not declared in this scope
    sasl/saslwrapper.h:190: error: ‘SASL_CB_AUTHNAME’ was not declared in this scope
    sasl/saslwrapper.h:193: error: ‘SASL_CB_PASS’ was not declared in this scope
    sasl/saslwrapper.h:195: error: ‘SASL_CB_PASS’ was not declared in this scope
    sasl/saslwrapper.h:203: error: ‘SASL_NEED_PROXY’ was not declared in this scope
    sasl/saslwrapper.h:205: error: ‘callbacks’ was not declared in this scope
    sasl/saslwrapper.h:205: error: ‘conn’ was not declared in this scope
    sasl/saslwrapper.h:205: error: ‘sasl_client_new’ was not declared in this scope
    sasl/saslwrapper.h:206: error: ‘SASL_OK’ was not declared in this scope
    sasl/saslwrapper.h:207: error: ‘sasl_errstring’ was not declared in this scope
    sasl/saslwrapper.h:211: error: ‘sasl_security_properties_t’ was not declared in this scope
    sasl/saslwrapper.h:211: error: expected ‘;’ before ‘secprops’
    sasl/saslwrapper.h:213: error: ‘secprops’ was not declared in this scope
    sasl/saslwrapper.h:220: error: ‘SASL_SEC_PROPS’ was not declared in this scope
    sasl/saslwrapper.h:220: error: ‘sasl_setprop’ was not declared in this scope
    sasl/saslwrapper.h:221: error: ‘SASL_OK’ was not declared in this scope
    sasl/saslwrapper.h:223: error: ‘sasl_dispose’ was not declared in this scope
    sasl/saslwrapper.h:229: error: ‘SASL_AUTH_EXTERNAL’ was not declared in this scope
    sasl/saslwrapper.h:230: error: ‘SASL_OK’ was not declared in this scope
    sasl/saslwrapper.h:232: error: ‘sasl_dispose’ was not declared in this scope
    sasl/saslwrapper.h:237: error: ‘SASL_SSF_EXTERNAL’ was not declared in this scope
    sasl/saslwrapper.h:238: error: ‘SASL_OK’ was not declared in this scope
    sasl/saslwrapper.h:240: error: ‘sasl_dispose’ was not declared in this scope
    sasl/saslwrapper.h: In member function ‘bool saslwrapper::ClientImpl::setAttr(const std::string&, const std::string&)’:
    sasl/saslwrapper.h:259: error: ‘secret’ was not declared in this scope
    sasl/saslwrapper.h:260: error: ‘sasl_secret_t’ was not declared in this scope
    sasl/saslwrapper.h:260: error: expected primary-expression before ‘)’ token
    sasl/saslwrapper.h:260: error: expected ‘;’ before ‘malloc’
    sasl/saslwrapper.h: In member function ‘bool saslwrapper::ClientImpl::start(const std::string&, std::string&, std::string&)’:
    sasl/saslwrapper.h:295: error: ‘sasl_interact_t’ was not declared in this scope
    sasl/saslwrapper.h:295: error: ‘prompt’ was not declared in this scope
    sasl/saslwrapper.h:301: error: ‘conn’ was not declared in this scope
    sasl/saslwrapper.h:301: error: ‘sasl_client_start’ was not declared in this scope
    sasl/saslwrapper.h:302: error: ‘SASL_INTERACT’ was not declared in this scope
    sasl/saslwrapper.h:304: error: ‘SASL_INTERACT’ was not declared in this scope
    sasl/saslwrapper.h:305: error: ‘SASL_OK’ was not declared in this scope
    sasl/saslwrapper.h:305: error: ‘SASL_CONTINUE’ was not declared in this scope
    sasl/saslwrapper.h: In member function ‘bool saslwrapper::ClientImpl::step(const std::string&, std::string&)’:
    sasl/saslwrapper.h:318: error: ‘sasl_interact_t’ was not declared in this scope
    sasl/saslwrapper.h:318: error: ‘prompt’ was not declared in this scope
    sasl/saslwrapper.h:323: error: ‘conn’ was not declared in this scope
    sasl/saslwrapper.h:323: error: ‘sasl_client_step’ was not declared in this scope
    sasl/saslwrapper.h:324: error: ‘SASL_INTERACT’ was not declared in this scope
    sasl/saslwrapper.h:326: error: ‘SASL_INTERACT’ was not declared in this scope
    sasl/saslwrapper.h:327: error: ‘SASL_OK’ was not declared in this scope
    sasl/saslwrapper.h:327: error: ‘SASL_CONTINUE’ was not declared in this scope
    sasl/saslwrapper.h: In member function ‘bool saslwrapper::ClientImpl::encode(const std::string&, std::string&)’:
    sasl/saslwrapper.h:340: error: ‘conn’ was not declared in this scope
    sasl/saslwrapper.h:340: error: ‘sasl_encode’ was not declared in this scope
    sasl/saslwrapper.h:341: error: ‘SASL_OK’ was not declared in this scope
    sasl/saslwrapper.h: In member function ‘bool saslwrapper::ClientImpl::decode(const std::string&, std::string&)’:
    sasl/saslwrapper.h:361: error: ‘conn’ was not declared in this scope
    sasl/saslwrapper.h:361: error: ‘sasl_decode’ was not declared in this scope
    sasl/saslwrapper.h:362: error: ‘SASL_OK’ was not declared in this scope
    sasl/saslwrapper.h: In member function ‘bool saslwrapper::ClientImpl::getUserId(std::string&)’:
    sasl/saslwrapper.h:378: error: ‘conn’ was not declared in this scope
    sasl/saslwrapper.h:378: error: ‘SASL_USERNAME’ was not declared in this scope
    sasl/saslwrapper.h:378: error: ‘sasl_getprop’ was not declared in this scope
    sasl/saslwrapper.h:379: error: ‘SASL_OK’ was not declared in this scope
    sasl/saslwrapper.h: In member function ‘bool saslwrapper::ClientImpl::getSSF(int*)’:
    sasl/saslwrapper.h:390: error: ‘conn’ was not declared in this scope
    sasl/saslwrapper.h:390: error: ‘SASL_SSF’ was not declared in this scope
    sasl/saslwrapper.h:390: error: ‘sasl_getprop’ was not declared in this scope
    sasl/saslwrapper.h:391: error: ‘SASL_OK’ was not declared in this scope
    sasl/saslwrapper.h: In member function ‘void saslwrapper::ClientImpl::addCallback(long unsigned int, void*)’:
    sasl/saslwrapper.h:407: error: ‘callbacks’ was not declared in this scope
    sasl/saslwrapper.h: In member function ‘void saslwrapper::ClientImpl::setError(const std::string&, int, const std::string&, const std::string&)’:
    sasl/saslwrapper.h:419: error: ‘conn’ was not declared in this scope
    sasl/saslwrapper.h:420: error: ‘sasl_errdetail’ was not declared in this scope
    sasl/saslwrapper.h:422: error: ‘sasl_errstring’ was not declared in this scope
    sasl/saslwrapper.h: At global scope:
    sasl/saslwrapper.h:434: error: variable or field ‘interact’ declared void
    sasl/saslwrapper.h:434: error: ‘sasl_interact_t’ was not declared in this scope
    sasl/saslwrapper.h:434: error: ‘prompt’ was not declared in this scope
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yp38hD/sasl/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-LVlbdm-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-yp38hD/sasl/

您应该尝试安装包 cyrus-sasl 和开发头文件 cyrus-sasl-devel

sudo yum install cyrus-sasl cyrus-sasl-devel