Python3.7:加载共享库时出错:libpython3.7m.so.1.0 [英] Python3.7: error while loading shared libraries: libpython3.7m.so.1.0
问题描述
我有两个版本 Python-2.7 和 Python-3.5,我可以分别使用 python(pip)
和 python3(pip3)
命令访问它们.然后我安装了另一个版本的 python(即 3.7.5)
.
I have two versions Python-2.7 , Python-3.5 which I was able to access with python(pip)
and python3(pip3)
command respectively. Then I have installed an another version of python (i.e 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
一切都成功了,但唯一的问题是我无法使用命令 python3.7
访问 Python-3.7.
Everything was successful but the only issue is I was not able to access Python-3.7 using the command python3.7
.
当我使用 python3.7 时,它返回以下错误:
When I used python3.7 it returned this following error:
python3.7:加载共享库时出错:libpython3.7m.so.1.0:无法打开共享对象文件:没有那个文件或目录
python3.7: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
谁能帮我解决这个问题?
Can anyone please help me regarding how to fix this issue?
信息:操作系统
:Debian GNU/Linux 9.11 (stretch)
Info: OS
: Debian GNU/Linux 9.11 (stretch)
输入时输出:
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
更新:
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
推荐答案
您需要将 /usr/local/lib/
添加到库搜索路径.您可以在运行 python3.7
之前在当前 shell 中调用以下内容:
You need to add /usr/local/lib/
to the library search path. You can call the following in the current shell before running python3.7
:
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
或者运行 ldconfig
来添加链接器缓存的路径:
Or run ldconfig
to add the path to the linker cache:
sudo ldconfig /usr/local/lib
这篇关于Python3.7:加载共享库时出错:libpython3.7m.so.1.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!