我正在使用CentOS 6.5并希望访问远程配置单元服务器。但是我无法使用pip install pyhs2
安装pyhs2。
我已经安装了所有必需的依赖项:
但我仍然得到同样的错误:
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
答案 0 :(得分:5)
这是Python3和依赖SASL的问题。 SASL目前编码为Python2。可以看到错误'PyString_AsString未在范围中声明'。
如果可能,短期解决方案是使用Python2。从长远来看,要么需要为Python3更新SASL依赖关系,要么pyhs2需要使用不同的依赖关系。
答案 1 :(得分:0)
快速更新: 现在似乎是'#34;安装"这个模块与pip-Python3(我试过3.5和3.6)是可能的。
但是,即使它安装了,你也无法在Python3中使用它,因为模块从未被移植到这样的版本(例如,它仍然使用" cStringIO"模块,在Python3中不再存在。
由于不再维护pyhs2(参见https://github.com/BradRuderman/pyhs2中的注释),您仍然坚持使用Python2,或者您最好切换到另一个工具以连接到HiverServer2。