我在/ opt / mqm /中安装了IBM MQ。这包含所有Header文件和库,特别是libmqic_r.so文件。
[aa@aa packages]# find /opt/mqm/ -name 'libmqic_r.so'
/opt/mqm/lib64/compat/libmqic_r.so
/opt/mqm/lib64/libmqic_r.so
/opt/mqm/lib/compat/libmqic_r.so
/opt/mqm/lib/libmqic_r.so
要使用build和build_ext安装PYMQI,我已经指定了以下所有路径 -
[aa@aa pymqi-1.4]# python setup.py config --verbose --include-dirs /opt/mqm/ --libraries /opt/mqm/ --library-dirs /opt/mqm/ --noisy
Building PyMQI client 64bits
running config
[aa@aa pymqi-1.4]# python setup.py build build_ext -I /opt/mqm/
Building PyMQI client 64bits
running build
running build_py
running build_ext
同样在/ opt / mqm目录中,所有权限都是RWXR_XR_X,为所有用户提供Read和Execute。 / opt / mqm也在默认的PATH环境变量中。
已安装的软件包 -
[aa@aajars]# yum list installed | grep MQ
MQSeriesClient.x86_64 7.5.0-5 @/MQSeriesClient-7.5.0-5.x86_64
MQSeriesJRE.x86_64 7.5.0-5 @/MQSeriesJRE-7.5.0-5.x86_64
MQSeriesJava.x86_64 7.5.0-5 @/MQSeriesJava-7.5.0-5.x86_64
MQSeriesMan.x86_64 7.5.0-5 @/MQSeriesMan-7.5.0-5.x86_64
MQSeriesRuntime.x86_64 7.5.0-5 @/MQSeriesRuntime-7.5.0-5.x86_64
MQSeriesSDK.x86_64 7.5.0-5 @/MQSeriesSDK-7.5.0-5.x86_64
MQSeriesSamples.x86_64 7.5.0-5 @/MQSeriesSamples-7.5.0-5.x86_64
MQSeriesXRClients.x86_64 7.5.0-5 @/MQSeriesXRClients-7.5.0-5.x86_64
[aa@aajars]# yum list installed | grep python-dev
python-devel.x86_64 2.6.6-51.el6 @localrepo
然而,毕竟这仍然是以下 -
Python 2.6.6 (r266:84292, Oct 15 2013, 07:32:41)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymqi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.linux-x86_64/egg/pymqi.py", line 109, in <module>
File "build/bdist.linux-x86_64/egg/pymqe.py", line 7, in <module>
File "build/bdist.linux-x86_64/egg/pymqe.py", line 6, in __bootstrap__
ImportError: libmqic_r.so: cannot open shared object file: No such file or directory
>>>
任何想法为什么会发生这种情况?
编辑 - 重建日志 -
[aa@aa pymqi-1.4]# python setup.py config --verbose --include-dirs /opt/mqm/ --libraries /opt/mqm/ --library-dirs /opt/mqm/ --noisy
Building PyMQI client 64bits
running config
[aa@aa pymqi-1.4]# python setup.py build build_ext -I /opt/mqm/
Building PyMQI client 64bits
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.6
copying pymqi.py -> build/lib.linux-x86_64-2.6
copying CMQC.py -> build/lib.linux-x86_64-2.6
copying CMQCFC.py -> build/lib.linux-x86_64-2.6
copying CMQXC.py -> build/lib.linux-x86_64-2.6
copying CMQZC.py -> build/lib.linux-x86_64-2.6
running build_ext
building 'pymqe' extension
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYQMI_SERVERBUILD=0 -I/opt/mqm/inc -I/opt/mqm/ -I/usr/include/python2.6 -c pymqe.c -o build/temp.linux-x86_64-2.6/pymqe.o
gcc -pthread -shared build/temp.linux-x86_64-2.6/pymqe.o -L/opt/mqm/lib64 -L/usr/lib64 -lmqic_r -lpython2.6 -o build/lib.linux-x86_64-2.6/pymqe.so
[aa@aa pymqi-1.4]# python setup.py install --record files.txt
Building PyMQI client 64bits
running install
running bdist_egg
running egg_info
writing pymqi.egg-info/PKG-INFO
writing top-level names to pymqi.egg-info/top_level.txt
writing dependency_links to pymqi.egg-info/dependency_links.txt
writing pymqi.egg-info/PKG-INFO
writing top-level names to pymqi.egg-info/top_level.txt
writing dependency_links to pymqi.egg-info/dependency_links.txt
reading manifest file 'pymqi.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'scripts/*.py'
writing manifest file 'pymqi.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.6/CMQZC.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.6/CMQC.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.6/CMQCFC.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.6/CMQXC.py -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.6/pymqe.so -> build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.6/pymqi.py -> build/bdist.linux-x86_64/egg
byte-compiling build/bdist.linux-x86_64/egg/CMQZC.py to CMQZC.pyc
byte-compiling build/bdist.linux-x86_64/egg/CMQC.py to CMQC.pyc
byte-compiling build/bdist.linux-x86_64/egg/CMQCFC.py to CMQCFC.pyc
byte-compiling build/bdist.linux-x86_64/egg/CMQXC.py to CMQXC.pyc
byte-compiling build/bdist.linux-x86_64/egg/pymqi.py to pymqi.pyc
creating stub loader for pymqe.so
byte-compiling build/bdist.linux-x86_64/egg/pymqe.py to pymqe.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying pymqi.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pymqi.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pymqi.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pymqi.egg-info/pbr.json -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pymqi.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/pymqi-1.4-py2.6-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing pymqi-1.4-py2.6-linux-x86_64.egg
Copying pymqi-1.4-py2.6-linux-x86_64.egg to /usr/lib64/python2.6/site-packages
Adding pymqi 1.4 to easy-install.pth file
Installed /usr/lib64/python2.6/site-packages/pymqi-1.4-py2.6-linux-x86_64.egg
Processing dependencies for pymqi==1.4
Finished processing dependencies for pymqi==1.4
writing list of installed files to 'files.txt'
[aa@aa pymqi-1.4]# cat files.txt
/usr/lib64/python2.6/site-packages/pymqi-1.4-py2.6-linux-x86_64.egg
[aa@aamanishm]# find /usr/lib64/python2.6/ -name '*pymqe*'
[aa@aamanishm]#
仍然没有创建pymqe: - (
编辑2 - 我在/root/.python-eggs/pymqi-1.4-py2.6-linux-x86_64.egg-tmp/中获得了pymqe.so文件。我将其复制到/usr/lib64/python2.6/site-packages/文件夹中。在我导入pymqi之后,我仍然会得到同样的错误。
答案 0 :(得分:1)
您必须将mqm库添加到库PATH:
在AIX / LINUX上编辑$ HOME / .profile文件,并在某处(通常在底部)添加mq libs的路径
对于Ubuntu:
export LD_LIBRARY_PATH=/opt/mqm/lib64:/opt/mqm/lib
为了找到图书馆的位置:
ionut@N552VX:~$ locate libmqic_r.so
/opt/mqm/lib/libmqic_r.so
/opt/mqm/lib/compat/libmqic_r.so
/opt/mqm/lib64/libmqic_r.so
/opt/mqm/lib64/compat/libmqic_r.so
AIX:
export LIBPATH=$LIBPATH:/usr/mqm/lib64:/usr/mqm/lib
从这里提取:
dspmqver
[..]
InstPath: /usr/mqm
[..]
更多信息以下链接:
http://www.ibm.com/support/knowledgecenter/SSS28S_8.2.1/API/api_configuring_unix_path.html
答案 1 :(得分:0)
在构建阶段,它还应该构建输出中缺少的“pymqe”扩展。构建步骤包括libmqic_r并添加库路径/ opt / mqm / lib64。
$ python setup.py build build_ext -I /opt/mqm/
Building PyMQI client 64bits
running build
running build_py
running build_ext
building 'pymqe' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYQMI_SERVERBUILD=0 -I/opt/mqm/inc -I/opt/mqm/ -I/usr/include/python2.6 -c pymqe.c -o build/temp.linux-x86_64-2.6/pymqe.o
gcc -pthread -shared build/temp.linux-x86_64-2.6/pymqe.o -L/opt/mqm/lib64 -L/usr/lib64 -lmqic_r -lpython2.6 -o build/lib.linux-x86_64-2.6/pymqe.so
running build_scripts
copying and adjusting scripts/mqmess.py -> build/scripts-2.6
copying and adjusting scripts/browse.py -> build/scripts-2.6
copying and adjusting scripts/inq.py -> build/scripts-2.6
您在构建包装后安装了吗? (应该以root身份完成系统范围的python包更新)
python setup.py install
尝试从头开始构建它。它应该构建一个pymqe.so共享对象,并且应该将它放在site-packages中。确保安装了MQ客户端软件包(尤其是SDK)和python-dev软件包。这些是先决条件。
下载PyMQI(1.4是最新的)源
$python setup.py build client
Building PyMQI client 64bits
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.6
copying pymqi.py -> build/lib.linux-x86_64-2.6
copying CMQC.py -> build/lib.linux-x86_64-2.6
copying CMQCFC.py -> build/lib.linux-x86_64-2.6
copying CMQXC.py -> build/lib.linux-x86_64-2.6
copying CMQZC.py -> build/lib.linux-x86_64-2.6
running build_ext
building 'pymqe' extension
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYQMI_SERVERBUILD=0 -I/opt/mqm/inc -I/usr/include/python2.6 -c pymqe.c -o build/temp.linux-x86_64-2.6/pymqe.o
gcc -pthread -shared build/temp.linux-x86_64-2.6/pymqe.o -L/opt/mqm/lib64 -L/usr/lib64 -lmqic_r -lpython2.6 -o build/lib.linux-x86_64-2.6/pymqe.so