1

导入脚本 pymqi 时出现奇怪的 ImportError 异常。

  1. 我安装了 WebSphere MQ for windows 7.5,包括用户和客户端版本。
  2. 我尝试运行 pip install pymqi,但 C++ 编译时出现问题。
  3. 我将标头从C:\Program Files (x86)\IBM\WebSphere MQ\tools\c\includeto移动C:\Python27\include并尝试运行,但存在链接问题。
  4. 我将一些.lib文件从C:\Program Files (x86)\IBM\WebSphere MQ\tools\Libto移到了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: �� ������ ��������� ������.

经过一些操作后我得到的...��...意思是:它找不到模块。

  1. 我决定做错了什么。下载pymqi-1.3并完成setup.py build+ setup.py install,成功完成。但问题仍然存在。
  2. 我将所有 DLL 文件C:\Program Files (x86)\IBM\WebSphere MQ\binC:\Python27

并得到另一个带有文本的 ImportError 异常,可能被翻译为“尝试访问内存地址错误”。

  1. 我尝试了 springpython 库,但它在里面使用了 pymqi,所以也有同样的例外。

我该如何最终解决这个问题?我想WebSphere端可能有问题,但是如何检查呢?“WS Explorer”运行良好。

4

1 回答 1

1

我有同样的问题。重新安装客户端似乎可以解决它。确保您的 PATH 变量中有以下项目:

C:\Program Files (x86)\IBM\WebSphere MQ\bin64; C:\Program Files (x86)\IBM\WebSphere MQ\bin; C:\Program Files (x86)\IBM\WebSphere MQ\tools\c\samples\bin

于 2015-06-18T01:05:00.090 回答