python:加载共享库时出错:libpython3.4m.so.1.0:无法打开共享对象文件:没有这样的文件或目录 [英] python: error while loading shared libraries: libpython3.4m.so.1.0: cannot open shared object file: No such file or directory

查看:68
本文介绍了python:加载共享库时出错:libpython3.4m.so.1.0:无法打开共享对象文件:没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 virtualenv 创建了一个 python 虚拟环境,激活它后,我可以看到 Python 安装在我的 shell 中的位置,如下所示:

I have created a python virtual environment using virtualenv, after activating it, I can see where is Python installed in my shell as following:

(virtualenv-test) bash-4.1$ whereis python
python: /usr/bin/python2.6 /usr/bin/python2.6-config /usr/bin/python
/usr/lib/python2.6 /usr/lib64/python2.6 /usr/X11R6/bin/python2.6
/usr/X11R6/bin/python2.6-config /usr/X11R6/bin/python
/usr/bin/X11/python2.6 /usr/bin/X11/python2.6-config
/usr/bin/X11/python /usr/include/python2.6
/usr/share/man/man1/python.1.gz

我还可以看到我正在使用的 python 版本:

Also I can see what python version I'm using:

(virtualenv-test) bash-4.1$ which python
/data/virtualenv-test/bin/python

然而,在输入python后,我收到以下错误信息:

However, after typing python, I got the following error message:

(virtualenv-test) bash-4.1$ python
python: error while loading shared libraries: libpython3.4m.so.1.0: cannot open shared object file: No such file or directory

潜在的原因是什么?

推荐答案

尝试将 python3.4 的 lib 路径添加到 $LD_LIBRARY_PATH 环境变量中.

Try adding the python3.4's lib path to the $LD_LIBRARY_PATH environment variable.

首先找出python3.4的lib路径(取决于你是如何安装python3.4的)

First find out the lib path of python3.4 (depends on how you installed python3.4)

对我来说是:/opt/python361/lib,然后将其添加到环境变量中,如下所示:

For me it was: /opt/python361/lib, then add it to environment variable like so:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/python361/lib

附言我在使用 virtualenvpython3.6 时遇到了类似的问题,我像这样修复了它:

P.S. I came across a similar problem while using virtualenv with python3.6, and I fixed it like so:

  • 首先,将 include 附加到 /etc/ld.so.conf (类似于:include/opt/python361/libinclude/usr/local/lib)
  • 然后,通过运行 sudo/sbin/ldconfig -v 来激活新配置.
  • First, append include <lib path of python3.x> to /etc/ld.so.conf (Something like: include /opt/python361/lib or include /usr/local/lib)
  • Then, activate the new configuration by running sudo /sbin/ldconfig -v.

这篇关于python:加载共享库时出错:libpython3.4m.so.1.0:无法打开共享对象文件:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆