导入脚本 pymqi 时出现奇怪的 ImportError 异常。
- 我安装了 WebSphere MQ for windows 7.5,包括用户和客户端版本。
- 我尝试运行 pip install pymqi,但 C++ 编译时出现问题。
- 我将标头从
C:\Program Files (x86)\IBM\WebSphere MQ\tools\c\include
to移动C:\Python27\include
并尝试运行,但存在链接问题。 - 我将一些
.lib
文件从C:\Program Files (x86)\IBM\WebSphere MQ\tools\Lib
to移到了C:\Python27\libs
,它编译得很好。
然后我尝试了这段代码:
import pymqi
queue_manager = "QM"
channel = "SVRCONN"
host = "192.168.1.252"
port = "1434"
conn_info = "%s(%s)" % (host, port)
qmgr = pymqi.connect(queue_manager, channel, conn_info)
qmgr.disconnect()
在导入库中,我得到了:
File "build\bdist.win32\egg\pymqe.py", line 7, in <module>
File "build\bdist.win32\egg\pymqe.py", line 6, in __bootstrap__
ImportError: DLL load failed: �� ������ ��������� ������.
经过一些操作后我得到的...��...
意思是:它找不到模块。
- 我决定做错了什么。下载pymqi-1.3并完成
setup.py build
+setup.py install
,成功完成。但问题仍然存在。 - 我将所有 DLL 文件
C:\Program Files (x86)\IBM\WebSphere MQ\bin
从C:\Python27
并得到另一个带有文本的 ImportError 异常,可能被翻译为“尝试访问内存地址错误”。
- 我尝试了 springpython 库,但它在里面使用了 pymqi,所以也有同样的例外。
我该如何最终解决这个问题?我想WebSphere端可能有问题,但是如何检查呢?“WS Explorer”运行良好。