1

This question here tells me how to install a specific version i.e. x.y.

I would like to install a specific version of Python x.y.z - eg 3.6.3 - while the default in Ubuntu 18.04 is Python 3.6.8.

Is there a way to install the specific patch number of the version of Python?

I tried the selected answer in the related question and I cannot install properly.

sudo apt install python3.6.3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python3.6.3
E: Couldn't find any package by glob 'python3.6.3'
E: Couldn't find any package by regex 'python3.6.3'

I am able to install a particular version, just not a patch number

sudo apt install python3.5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libpython3.5-minimal libpython3.5-stdlib python3.5-minimal
Suggested packages:
  python3.5-venv python3.5-doc binfmt-support
The following NEW packages will be installed:
  libpython3.5-minimal libpython3.5-stdlib python3.5 python3.5-minimal
0 upgraded, 4 newly installed, 0 to remove and 501 not upgraded.
Need to get 4,113 kB of archives.
After this operation, 22.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.
sudo apt install python3.5.2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python3.5.2
E: Couldn't find any package by glob 'python3.5.2'
E: Couldn't find any package by regex 'python3.5.2'

2 Answers2

4
sudo apt-get install libssl-dev openssl
wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
tar xzvf Python-3.5.0.tgz
cd Python-3.5.0
./configure
make
sudo make install
Murphy
  • 1,677
0

This is a bit late, but instead of install from source yourself, you can use a tool like pyenv to handle this. Example:

pyenv install 3.9.8
pyenv local 3.9.8  # Activate Python 3.9 for the current project or
pyenv global 3.9.8  # Activate Python 3.9 globaly

Read more about pyenv here

tturbo
  • 111