简体   繁体   English

Python3.7:加载共享库时出错:libpython3.7m.so.1.0

[英]Python3.7: error while loading shared libraries: libpython3.7m.so.1.0

I have two versions Python-2.7, Python-3.5 which I was able to access with python(pip) and python3(pip3) command respectively.我有两个版本 Python-2.7,Python-3.5,我可以分别使用python(pip)python3(pip3)命令访问它们。 Then I have installed an another version of python (ie 3.7.5) .然后我安装了另一个版本的python (ie 3.7.5)

I have used these commands to install it.我已经使用这些命令来安装它。

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev

wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz
tar xvf Python-3.7.5.tgz
cd Python-3.7.5
./configure --enable-optimizations --enable-shared
make -j6
sudo make altinstall

Everything was successful but the only issue is I was not able to access Python-3.7 using the command python3.7 .一切都很成功,但唯一的问题是我无法使用命令python3.7访问 Python-3.7 。

When I used python3.7 it returned this following error:当我使用 python3.7 时,它返回了以下错误:

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

Can anyone please help me regarding how to fix this issue?谁能帮我解决这个问题?

Info: OS : Debian GNU/Linux 9.11 (stretch)信息: OS :Debian GNU/Linux 9.11(拉伸)

Output when I type: Output 当我输入:

user_83@debian-241:~$ whereis python     
python: /usr/bin/python3.5m-config 
/usr/bin/python3.5m 
/usr/bin/python2.7-config 
/usr/bin/python3.5 
/usr/bin/python2.7 
/usr/bin/python 
/usr/bin/python3.5-config 
/usr/lib/python3.5 
/usr/lib/python2.7 
/etc/python3.5 
/etc/python2.7 
/etc/python 
/usr/local/bin/python3.7m 
/usr/local/bin/python3.7 
/usr/local/bin/python3.7m-config 
/usr/local/lib/python3.5 
/usr/local/lib/python2.7 
/usr/local/lib/python3.7
/usr/include/python3.5m 
/usr/include/python3.5 
/usr/include/python2.7 
/usr/share/python 
/usr/share/man/man1/python.1.gz

UPDATE:更新:

locate libpython3.5m

/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/libpython3.5m-pic.a
/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/libpython3.5m.a
/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/libpython3.5m.so
/usr/lib/x86_64-linux-gnu/libpython3.5m.a
/usr/lib/x86_64-linux-gnu/libpython3.5m.so
/usr/lib/x86_64-linux-gnu/libpython3.5m.so.1
/usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0

locate libpython3.7m
/usr/local/lib/libpython3.7m.so
/usr/local/lib/libpython3.7m.so.1.0
/usr/local/lib/python3.7/config-3.7m-x86_64-linux-gnu/libpython3.7m.a


sudo ldconfig /usr/local/lib 

ldconfig: /usr/lib/libnvinfer.so.5 is not a symbolic link
ldconfig: /usr/lib/libnvonnxparser_runtime.so.0 is not a symbolic link
ldconfig: /usr/lib/libnvonnxparser.so.0 is not a symbolic link
ldconfig: /usr/lib/libnvparsers.so.5 is not a symbolic link
ldconfig: /usr/lib/libnvinfer_plugin.so.5 is not a symbolic link

You need to add /usr/local/lib/ to the library search path.您需要将/usr/local/lib/添加到库搜索路径。 You can call the following in the current shell before running python3.7 :在运行python3.7之前,您可以在当前 shell 中调用以下内容:

export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib

Or run ldconfig to add the path to the linker cache:或者运行ldconfig将路径添加到 linker 缓存:

sudo ldconfig /usr/local/lib 

Thanks All for sharing, but none of these worked for me, instead I just installed the required library using:谢谢大家的分享,但这些都不适合我,我只是使用以下方法安装了所需的库:

sudo apt-get install libpython3.7

I'm using homebrew/linuxbrew to manage my latest python3 version.我正在使用 homebrew/linuxbrew 来管理我最新的 python3 版本。 Doing this export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/home/linuxbrew/.linuxbrew/Cellar/python@3.8/3.8.3/lib works for me (no reboot need).执行此export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/home/linuxbrew/.linuxbrew/Cellar/python@3.8/3.8.3/lib对我有用(无需重新启动)。

If someone is still looking for a solution due to Pycharm IDE如果有人因为Pycharm IDE仍在寻找解决方案

Situation:情况:

  • OS: ubuntu 18.04.4操作系统:ubuntu 18.04.4
  • This Problem occurred after the installation of caffe (cuda).安装caffe (cuda) 后出现此问题。

Weirdly enough it works if python script is executed from the terminal but as soon I use Pycharm IDE it shows above error奇怪的是,如果 python 脚本是从终端执行的,但是一旦我使用Pycharm IDE它就会显示上述错误


Solution:解决方案:

What worked is a solution by @Vladstein Vomithler and @Dharman有效的是@Vladstein Vomithler 和@Dharman 的解决方案

I lack the understanding of the problem and why it occurred, it would be very helpful if someone can comment about that我缺乏对问题及其发生原因的理解,如果有人可以对此发表评论,那将非常有帮助

暂无
暂无

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

相关问题 加载共享库 libpython3.7m.so.1.0 时出错:没有这样的文件或目录(/usr/local/bin/coverage 需要) - Error loading shared library libpython3.7m.so.1.0: No such file or directory (needed by /usr/local/bin/coverage) 问:python(在集群的bash脚本中使用cutadapt):libpython3.7m.so.1.0:无法打开共享对象文件:无此类文件或目录 - Q: python (using cutadapt in bash script on cluster): libpython3.7m.so.1.0: cannot open shared object file: No such file or directory ImportError:libpython3.7m.so.1.0:无法打开共享 object 文件:没有这样的文件或目录 - ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory 错误加载 Python lib '/tmp/_MEIR5kRcn/libpython3.7m.so.1.0': dlopen: libcrypt.so.1 在运行期间 docker-compose - Error loading Python lib '/tmp/_MEIR5kRcn/libpython3.7m.so.1.0': dlopen: libcrypt.so.1 during running docker-compose 加载 Python lib '/tmp/_MEItueAuk/libpython3.7m.so.1.0' 时出错:dlopen: /lib/x86_64-linux-gnu/libc.so.6: 找不到版本 'GLIBC_2.28' - Error loading Python lib '/tmp/_MEItueAuk/libpython3.7m.so.1.0': dlopen: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found 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 加载共享库时出现 Python 错误:libpython3.5m.so.1.0:无法打开共享对象文件:没有这样的文件或目录 - Python error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory docker-compose “/usr/local/bin/python: error while loading shared libraries: libpython3.8.so.1.0:”时出错 - Error when docker-compose “/usr/local/bin/python: error while loading shared libraries: libpython3.8.so.1.0: ” 加载共享库时出错:在ubuntu中制作虚拟环境时,libpython2.7.so.1.0 - error while loading shared libraries: libpython2.7.so.1.0 when making virtual env in ubuntu PyTorch 1.0在Python3.7中加载VGGFace2权重 - PyTorch 1.0 loading VGGFace2 weights in Python3.7
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM