作者热门文章
- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我试图从终端运行 python 脚本但收到下一条错误消息:
ImportError: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
如果我运行 print sys.version 我会得到:
>>> import sys
>>> print sys.version
2.7.3 (default, Feb 26 2013, 16:27:39)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]
如果我运行 ldd/usr/local/bin/python
>> ldd /usr/local/bin/python
linux-vdso.so.1 => (0x00007fff219ff000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003300c00000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003300800000)
libutil.so.1 => /lib64/libutil.so.1 (0x0000003310e00000)
libm.so.6 => /lib64/libm.so.6 (0x0000003300000000)
libc.so.6 => /lib64/libc.so.6 (0x0000003300400000)
/lib64/ld-linux-x86-64.so.2 (0x00000032ffc00000)
我不明白我有哪条 python ?为什么从终端运行这个 python 脚本失败了?我尝试过运行
export LD_LIBRARY_PATH=/usr/local/lib/python2.7/
没有运气......
顺便说一句 - 我已经设法在 eclipse 中使用 python 插件调试了这个脚本,当我查看调试配置时,我看到 PYTHONPATH 设置为:
/..../eclipse/plugins/org.python.pydev_3.1.0.201312121632/pysrc/pydev_sitecustomize:/..../workspace/style_checker/src:/usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg:/usr/local/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg:/usr/local/lib/python2.7:/usr/local/lib/python2.7/plat-linux2:/usr/local/lib/python2.7/lib-tk:/usr/local/lib/python2.7/lib-dynload:/usr/local/lib/python2.7/site-packages
所以 eclipse 设法以某种方式找到这个 python2.7 库......那么我如何在没有 eclipse 和命令行的情况下做到这一点?我究竟做错了什么 ?使用 CentOS6。
最佳答案
尝试查找文件libpython2.7.so.1.0
:
找到 libpython2.7.so.1.0
在我的例子中,它显示出来:
/opt/rh/python27/root/usr/lib64/libpython2.7.so.1.0
然后将行 /opt/rh/python27/root/usr/lib64
粘贴到文件 /etc/ld.so.conf
然后运行 ldconfig
。它解决了我的问题。祝你好运!
关于python - libpython2.7.so.1.0 : cannot open shared object file: No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20842732/
我是一名优秀的程序员,十分优秀!