How do I install Python3.7 on Ubuntu 16?

1.1k Views Asked by At

I tried this approach but got:

add-apt-repository ppa:deadsnakes/ppa
Error processing line 1 of /usr/local/lib/python3.5/dist-packages/distutils-precedence.pth:

  Traceback (most recent call last):
    File "/usr/lib/python3.5/site.py", line 173, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "/usr/local/lib/python3.5/dist-packages/_distutils_hack/__init__.py", line 194
      f'spec_for_{name}',
                       ^
  SyntaxError: invalid syntax

Remainder of file ignored

Building dependency tree       
Reading state information... Done
E: Unable to locate package python3.7
E: Couldn't find any package by glob 'python3.7'
E: Couldn't find any package by regex 'python3.7'

It looks like some package is running a Python3.6 script in Python3.5. Is this related to the problem?

How do I install Python3.7?

1

There are 1 best solutions below

1
Muhammad Aasharib Nawshad On

Just do these steps

sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget

wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
sudo tar xzf Python-3.7.4.tgz

cd Python-3.7.4

sudo ./configure
sudo make
sudo make install