2015-11-06 145 views
3

我需要PyMQI在我的Windows 86x上。 我試圖用MSVC建立setup.py的編譯器 但是當我嘗試這樣做,我得到以下錯誤:用於Windows的PyMQI構建和安裝

C:\Python27\Lib\pymqi-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:\Users\Admin\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD 
/W3 /GS- /DNDEBUG -DPYQMI_SERVERBUILD=0 "-Ic:\Program Files\IBM\WebSphere MQ\tools\c\include" -IC:\Python27\include -IC 
:\Python27\PC /Tcpymqi/pymqe.c /Fobuild\temp.win32-2.7\Release\pymqi/pymqe.obj 
pymqe.c 
pymqi/pymqe.c(240) : error C2275: 'MQCSP' : illegal use of this type as an expression 
     c:\Program Files\IBM\WebSphere MQ\tools\c\include\cmqc.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 
+0

[文森特](HTTP:/ /stackoverflow.com/users/5573130)指出,他有同樣的問題,在IBM MQ客戶端8.0.0.4上運行Windows 7 64位上的Python 2.7.9。 – cgmb

+0

我也面臨同樣的問題。我使用MQ v7.5.0.2在Windows x86上運行Pythong 2.7.12。有沒有人找到解決方案呢? – Piyush

+0

同樣的問題在這裏...沒有ideea呢:( –

回答

1

有此頁面上有一個解決方案: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 

這可以通過從路徑\pymqi-1.5.4\build\lib.win32-2.7\pymqi複製pymqe.pyd是固定的,以pymqi-1.5.4\pymqi