Issue
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
Everything was successful but the only issue is I was not able to access Python-3.7 using the command python3.7
.
When I used python3.7 it returned this following error:
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?
Info: OS
: Debian GNU/Linux 9.11 (stretch)
Output when I type:
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
Solution
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
Or run ldconfig
to add the path to the linker cache:
sudo ldconfig /usr/local/lib
Answered By - MEE