我正在使用CentOS 6.5,并想访问远程配置单元服务器。但是我无法使用pip install pyhs2安装pyhs2。

我已经安装了所有必需的依赖项:


gcc-c ++
python-devel.x86_64
cyrus-sasl-devel.x86_64


但仍然出现相同的错误:

Failed building wheel for sasl
Failed to build sasl
Installing collected packages: sasl, pyhs2
Running setup.py install for sasl
Complete output from command /usr/local/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-vq9qfls4/sasl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-bjam3ra0-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
running egg_info
writing top-level names to sasl.egg-info/top_level.txt
writing dependency_links to sasl.egg-info/dependency_links.txt
writing sasl.egg-info/PKG-INFO
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'
running build_ext
building '_saslwrapper' extension
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/opt/include/python3.4m -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-3.4/sasl/saslwrapper.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
sasl/saslwrapper.cpp: In member function ‘void saslwrapper::ClientImpl::interact(sasl_interact_t*)’:
sasl/saslwrapper.cpp:341: warning: unused variable ‘input’
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/opt/include/python3.4m -c sasl/saslwrapper_wrap.cxx -o build/temp.linux-x86_64-3.4/sasl/saslwrapper_wrap.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
sasl/saslwrapper_wrap.cxx: In function ‘void SWIG_Python_AddErrorMsg(const char*)’:
sasl/saslwrapper_wrap.cxx:884: error: ‘PyString_AsString’ was not declared in this scope
sasl/saslwrapper_wrap.cxx: In function ‘PySwigClientData* PySwigClientData_New(PyObject*)’:
sasl/saslwrapper_wrap.cxx:1275: error: ‘PyClass_Check’ was not declared in this scope
sasl/saslwrapper_wrap.cxx: In function ‘PyObject* PySwigObject_format(const char*, PySwigObject*)’:
sasl/saslwrapper_wrap.cxx:1348: error: ‘PyString_FromString’ was not declared in this scope
sasl/saslwrapper_wrap.cxx:1350: error: ‘PyString_Format’ was not declared in this scope
sasl/saslwrapper_wrap.cxx: In function ‘PyObject* PySwigObject_repr(PySwigObject*)’:
sasl/saslwrapper_wrap.cxx:1380: error: ‘PyString_AsString’ was not declared in this scope
sasl/saslwrapper_wrap.cxx:1380: error: ‘PyString_FromFormat’ was not declared in this scope
sasl/saslwrapper_wrap.cxx:1388: error: ‘PyString_ConcatAndDel’ was not declared in this scope
sasl/saslwrapper_wrap.cxx: In function ‘int PySwigObject_print(PySwigObject*, FILE*, int)’:
sasl/saslwrapper_wrap.cxx:1402: error: ‘PyString_AsString’ was not declared in this scope
sasl/saslwrapper_wrap.cxx: In function ‘PyObject* PySwigObject_str(PySwigObject*)’:
sasl/saslwrapper_wrap.cxx:1415: error: ‘PyString_FromString’ was not declared in this scope
sasl/saslwrapper_wrap.cxx: In function ‘PyTypeObject* _PySwigObject_type()’:
sasl/saslwrapper_wrap.cxx:1624: error: ‘coercion’ was not declared in this scope
sasl/saslwrapper_wrap.cxx:1624: error: expected ‘}’ before numeric constant
sasl/saslwrapper_wrap.cxx:1624: error: too many initializers for ‘PyNumberMethods’
sasl/saslwrapper_wrap.cxx:1624: error: invalid conversion from ‘PyObject* (*)(PyObject*, PyObject*)’ to ‘PyObject* (*)(PyObject*, PyObject*, PyObject*)’
sasl/saslwrapper_wrap.cxx:1624: error: invalid conversion from ‘PyObject* (*)(PyObject*, PyObject*, PyObject*)’ to ‘PyObject* (*)(PyObject*)’
sasl/saslwrapper_wrap.cxx:1624: error: invalid conversion from ‘PyObject* (*)(PyObject*)’ to ‘int (*)(PyObject*)’
sasl/saslwrapper_wrap.cxx:1624: error: invalid conversion from ‘int (*)(PyObject*)’ to ‘PyObject* (*)(PyObject*)’
sasl/saslwrapper_wrap.cxx:1624: error: expected ‘,’ or ‘;’ before numeric constant
sasl/saslwrapper_wrap.cxx:1604: warning: unused variable ‘swigobject_doc’
sasl/saslwrapper_wrap.cxx:1606: warning: unused variable ‘PySwigObject_as_number’
sasl/saslwrapper_wrap.cxx:1637: warning: no return statement in function returning non-void
sasl/saslwrapper_wrap.cxx: At global scope:
sasl/saslwrapper_wrap.cxx:1641: error: expected unqualified-id before ‘if’
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/stdexcept:38,
                 from sasl/saslwrapper_wrap.cxx:2542:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/exception:35: error: expected ‘}’ before end of line
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/exception:35: error: expected declaration before end of line
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/usr/local/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-vq9qfls4/sasl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-bjam3ra0-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-vq9qfls4/sasl

最佳答案

这是Python3和依赖项SASL的问题。 SASL当前为Python2编码。出现错误“未在范围中声明PyString_AsString”。

如果可能的话,短期解决方案是使用Python2。从长远来看,要么需要为Python3更新SASL依赖关系,要么需要使用不同的pyhs2依赖关系。

08-26 21:44