一、在HP-UX上的手动编译安装PyMQI
1.编译得到pymqe.so (编译选项见4.makefile)

make clean
make release

2.复制以下文件到:/xxx/lib
pymqi.py
CMQZC.py
CMQXC.py
CMQCFC.py
CMQC.py
pymqe.so (上面的编译步骤得到的)
libffi.so (此文件来自http://hpux.connect.org.uk)

3.设置环境变量

export PYTHONPATH=/xxx/lib
export LD_LIBRARY_PATH=/xxx/lib:$LD_LIBRARY_PATH

4.makefile

# -b creates a shared library
# -s to be stripped of symbol table information
release:pymqe.o
 aCC -Ae -b -s pymqe.o \
  -L/usr/local/lib/hpux32 \
  -lpython2.7 \
  -L/opt/mqm/lib \
  -lmqic_r \
  -o pymqe.so

# -Ae aC++ as an ANSI C compiler
# +z Compiling for Shared Libraries
pymqe.o:pymqe.c
 aCC -Ae +z \
  -I/usr/local/include \
  -I/usr/local/include/python2.7 \
  -I/opt/mqm/inc \
  -c pymqe.c \
  -o pymqe.o

clean:
 rm -f *.o
 rm -f pymqe.so

二、在Windows上的安装PyMQI
1.安装setuptools

python setup.py build
python setup.py install

2.安装pymqi

python setup.py build client
python setup.py install

三、测试代码

import pymqi
qmgr=pymqi.connect('QM_TEST', 'CHANNEL_TEST', '127.0.0.1(1414)')
que=pymqi.Queue(qmgr, 'QUEUE_TEST')
que.put("test_msg")
que.get()
que.close()
qmgr.disconnect()

四、参考
https://pypi.python.org/pypi/pymqi
http://pythonhosted.org/pymqi/
http://www.ibm.com/developerworks/websphere/library/techarticles/0708_salkosuo/0708_salkosuo.html
http://www.ibm.com/developerworks/cn/downloads/ws/wmq/


本文链接地址: Python访问WebSphere MQ:PyMQI的安装
https://blog.qingfengju.com/index.asp?id=353

上一篇: 使用GoldWave自动分割音频文件
下一篇: 替换CCRC的对比工具为WinMerge

分类:脚本编程 查看次数:10670 发布时间:2013/10/25 12:21:48