I have Ubuntu 18.04 LST with Python 2.7.17
and Python 3.6.9
preinstalled.
I have installed Python 3.8.2
via:
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget
sudo wget https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tar.xz
tar -xf Python-3.8.2.tar.xz
cd Python-3.8.2
./configure --enable-optimizations
make -j 8
sudo make altinstall
The default versions for ~$ python -V
and ~$ python3 -V
are then:
Python 2.7.17
Python 3.6.9
When I run ~$ ls -l /usr/bin/python*
, I get the following (see image for full output):
-rwxr-xr-x 1 root root 3637096 Apr 15 13:20 /usr/bin/python2.7
-rwxr-xr-x 2 root root 4526456 Apr 17 21:56 /usr/bin/python3.6
-rwxr-xr-x 1 root root 5203488 Oct 28 2019 /usr/bin/python3.8
python versions installed on Ubuntu
I want to know how to remove Python 3.8.2
without damaging the preinstalled versions Python 2.7.17
and Python 3.6.17
?
For further information:
I want to do this to install TensorFlow with GPU support. As per TensorFlow documentation TensorFlow: Package location, it only has support up to Python3.7
.
Or would it be possible to have several versions of Python installed without affecting Ubuntu functionality?
Also, how do I make sure that when I install packages via pip
or pip3
, those packages are installed for the desired Python version, e.g. Python 3.8.2
?
Thanks in advance for your help!