简体   繁体   English

如何克服 Python ImportError: libmqic_r.so: cannot open shared object file: No such file or directory

[英]How to over come Python ImportError: libmqic_r.so: cannot open shared object file: No such file or directory

I have IBM MQ Installed in /opt/mqm/.我在 /opt/mqm/ 中安装了 IBM MQ。 This has all the Header files and libraries and specifically the libmqic_r.so file.这包含所有头文件和库,特别是 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

To Install PYMQI using the build and the build_ext, i have specified all the paths as below -要使用 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

Also on the /opt/mqm directory all permissions are RWXR_XR_X giving Read and Execute to all users.同样在 /opt/mqm 目录中,所有权限都是 RWXR_XR_X,为所有用户提供读取和执行权限。 /opt/mqm in the default PATH environment variables too. /opt/mqm 也在默认的 PATH 环境变量中。

Installed Packages -已安装的软件包 -

[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

However after all this is still get the below -然而毕竟这仍然是得到以下 -

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
>>>

Any ideas why is this happening?任何想法为什么会发生这种情况?

Edit - Rebuild Log -编辑 - 重建日志 -

[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]#

Still no pymqe created :-(仍然没有创建 pymqe :-(

Edit 2 - I got the pymqe.so file in /root/.python-eggs/pymqi-1.4-py2.6-linux-x86_64.egg-tmp/.编辑 2 - 我在 /root/.python-eggs/pymqi-1.4-py2.6-linux-x86_64.egg-tmp/ 中得到了 pymqe.so 文件。 I copied it to the /usr/lib64/python2.6/site-packages/ folder.我将它复制到 /usr/lib64/python2.6/site-packages/ 文件夹。 After that too when I import pymqi, I still get the same same error.在那之后,当我导入 pymqi 时,我仍然遇到同样的错误。

You have to add the mqm libraries to your library PATH:您必须将 mqm 库添加到您的库路径中:

On AIX/LINUX edit $HOME/.profile file and add somewhere (usually at the bottom) the path to the mq libs在 AIX/LINUX 上编辑 $HOME/.profile 文件并在某处(通常在底部)添加到 mq 库的路径

for Ubuntu:对于 Ubuntu:

export LD_LIBRARY_PATH=/opt/mqm/lib64:/opt/mqm/lib

in order to find where the library is:为了找到图书馆在哪里:

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

extracted from here:从这里提取:

    dspmqver
[..]
    InstPath:    /usr/mqm
[..]

more info the link below:更多信息请点击以下链接:

http://www.ibm.com/support/knowledgecenter/SSS28S_8.2.1/API/api_configuring_unix_path.html http://www.ibm.com/support/knowledgecenter/SSS28S_8.2.1/API/api_configuring_unix_path.html

During the build stage, it should also build the 'pymqe' extension which is missing in your output.在构建阶段,它还应该构建输出中缺少的“pymqe”扩展。 The build step includes the libmqic_r and adds the library path /opt/mqm/lib64.构建步骤包括 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

Did you install after building the package?你是在构建包后安装的吗? (should be done as root for a system wide python package update) (应该以 root 身份进行系统范围的 python 包更新)

python setup.py install

Try to build it from scratch.尝试从头开始构建它。 It should build a pymqe.so shared object and install should put it in the site-packages.它应该构建一个 pymqe.so 共享对象,并且安装应该将它放在站点包中。 Make sure you have MQ client packages (especially SDK) and python-dev package installed.确保您安装了 MQ 客户端包(尤其是 SDK)和 python-dev 包。 These are the pre-requisites.这些是先决条件。

Download PyMQI (1.4 is the latest) source下载 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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 python`ImportError:libboost_python27.so.1.67.0:无法打开共享对象文件:没有这样的文件或目录` - python `ImportError: libboost_python27.so.1.67.0: cannot open shared object file: No such file or directory ` ImportError:libboost_python.so.1.41.0:无法打开共享对象文件:没有这样的文件或目录 - ImportError: libboost_python.so.1.41.0: cannot open shared object file: No such file or directory ImportError:libcudnn.so.5:无法打开共享对象文件:没有这样的文件或目录,带有Tensorflow-gpu的Python 2.7 - ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory, Python 2.7 with Tensorflow-gpu 导入错误:libboost_python.so.1.65.1:无法打开共享对象文件:没有这样的文件或目录 - ImportError: libboost_python.so.1.65.1: cannot open shared object file: No such file or directory 而导入python。 ImportError:libcublas.so.9.0:无法打开共享对象文件:没有这样的文件或目录 - While Import python. ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory ImportError:libcublas.so.8.0:无法打开共享对象文件:没有这样的文件或目录(共享Linux) - ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory (Shared Linux) ImportError:无法在Python中打开共享对象文件 - ImportError: Cannot open shared object file in Python Python3.5 导入错误:libpython3.5m.so.1.0:无法打开共享对象文件:没有这样的文件或目录 - Python3.5 ImportError: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory ImportError:libcudart.so.7.0:无法打开共享对象文件:没有这样的文件或目录 - ImportError: libcudart.so.7.0: cannot open shared object file: No such file or directory 导入错误:libgeos-3.6.2.so:无法打开共享对象文件:没有这样的文件或目录 - ImportError: libgeos-3.6.2.so: cannot open shared object file: No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM