-1

While trying to download the python package in ubuntu 19.10, got this error. Tried sudo apt-get update, but of no use. How can I install the python in ubuntu server

While trying the download python package in ubuntu 19.10, got this error. Tried sudo apt-get update, but of no use. How can I install the python in ubuntu server

  • how did u get ubuntu 19? i saw only 16, 18, then 20 – Dee Feb 04 '21 at 10:22
  • Google works wonders: https://askubuntu.com/questions/865554/how-do-i-install-python-3-6-using-apt-get – ForceBru Feb 04 '21 at 10:22
  • Non-LTS releases (all except {even number}.04) of Ubuntu have a very short support time. More than a year later you should update to 20.04 to get software and updates. – Klaus D. Feb 04 '21 at 10:28
  • *Why* do you want to install Python 3.6, specifically? It’s not the most recent version. Furthermore, as Klaus said, you shouldn’t be running on Ubuntu 19.10. Update your system, *then* install an up-to-date Python (or whichever version you need). – Konrad Rudolph Feb 04 '21 at 10:31
  • I tried to install other python versions as well, However I have the same issue. The screenshot attached is for reference. Since I had issues with PIP package, i have removed the PIP and python to reinstall it – Jaya chandra Feb 04 '21 at 10:59

2 Answers2

0

Python 3.6+ should be available by default on Ubuntu 18+, thus find out which Python version is available as listed in package repo files first:

sudo apt search --names-only "^python3\."

See the results and choose 1 of them to install:

sudo apt install python3.6 # Or 3.7 3.8 3.9, etc
Dee
  • 7,455
  • 6
  • 36
  • 70
0

To install python:

sudo apt-get install python3

But Ubuntu already comes with python, so you just use python3. Note that in Ubuntu you always must specify the version 3. To execute a file, run:

python3 file.py

EDIT:

To install python 3.6 specifically, execute:

sudo add-apt-repository ppa:fkrull/deadsnakes 
sudo apt-get update 
sudo apt-get install python3.6
Diego Palacios
  • 1,096
  • 6
  • 22
  • Will this always install Python 3.6? – ForceBru Feb 04 '21 at 10:27
  • This will install the latest version of python in the repository. If you want to deal with different versions of python, you should use anaconda or something similar to create virtual environments. – Diego Palacios Feb 04 '21 at 10:32
  • I mean, OP wants Python 3.6 specifically, but this answer currently suggests to install the latest version, which may not be 3.6 – ForceBru Feb 04 '21 at 10:35
  • I have updated the answer, you must add a ppa – Diego Palacios Feb 04 '21 at 10:38
  • Error: sudo: add-apt-repository: command not found, tried using sudo apt-get install software-properties-common, got the below error:The following packages have unmet dependencies: Depends: python3 but it is not going to be installed – Jaya chandra Feb 04 '21 at 11:05