PyMQI for Windows build & install



我的windows 86x上需要PyMQI。我尝试用msvc作为编译器来构建setup.py但当我尝试这样做时,我会得到以下错误:

C:Python27Libpymqi-1.5.4>python setup.py build client
Building PyMQI client 32bits
running build
running build_py
running build_ext
building 'pymqi.pymqe' extension
C:UsersAdminAppDataLocalProgramsCommonMicrosoftVisual C++ for Python9.0VCBincl.exe /c /nologo /Ox /MD
 /W3 /GS- /DNDEBUG -DPYQMI_SERVERBUILD=0 "-Ic:Program FilesIBMWebSphere MQtoolscinclude" -IC:Python27include -IC
:Python27PC /Tcpymqi/pymqe.c /Fobuildtemp.win32-2.7Releasepymqi/pymqe.obj
pymqe.c
pymqi/pymqe.c(240) : error C2275: 'MQCSP' : illegal use of this type as an expression
        c:Program FilesIBMWebSphere MQtoolscincludecmqc.h(4001) : see declaration of 'MQCSP'
pymqi/pymqe.c(240) : error C2146: syntax error : missing ';' before identifier 'csp'
pymqi/pymqe.c(240) : error C2065: 'csp' : undeclared identifier
pymqi/pymqe.c(240) : error C2059: syntax error : '{'
pymqi/pymqe.c(247) : error C2065: 'csp' : undeclared identifier
pymqi/pymqe.c(247) : error C2224: left of '.AuthenticationType' must have struct/union type
pymqi/pymqe.c(248) : error C2065: 'csp' : undeclared identifier
pymqi/pymqe.c(248) : error C2224: left of '.CSPUserIdPtr' must have struct/union type
pymqi/pymqe.c(249) : error C2065: 'csp' : undeclared identifier
pymqi/pymqe.c(249) : error C2224: left of '.CSPUserIdLength' must have struct/union type
pymqi/pymqe.c(250) : error C2065: 'csp' : undeclared identifier
pymqi/pymqe.c(250) : error C2224: left of '.CSPPasswordPtr' must have struct/union type
pymqi/pymqe.c(251) : error C2065: 'csp' : undeclared identifier
pymqi/pymqe.c(251) : error C2224: left of '.CSPPasswordLength' must have struct/union type
pymqi/pymqe.c(256) : error C2065: 'csp' : undeclared identifier
pymqi/pymqe.c(256) : warning C4133: '=' : incompatible types - from 'int *' to 'PMQCSP'
error: command 'C:\Users\Admin\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bi
n\cl.exe' failed with exit status 2

此页面上有一个解决方案:https://github.com/dsuch/pymqi/issues/35

pymqi/pymqe.c文件中的第一个声明行

MQCSP csp = {MQCSP_DEFAULT};

应移到方法pymqe_MQCONNX的开头,紧接在:之后

PyObject* user_password = NULL;

完成此操作后,构建和安装成功,但import pymqi给出错误:

ImportError: No module named pymqe

这可以通过将pymqe.pyd从路径pymqi-1.5.4buildlib.win32-2.7pymqi复制到pymqi-1.5.4pymqi

来解决

相关内容

最新更新