ObjectivePython 3 comes pre-installed as a default python interpreter for Ubuntu 18.04 desktop and server.
However, on other minimal Ubuntu 18.04 installations, eg. docker, python is missing and needs to be installed manually. The following guide will provide you with information on how to install Python in Ubuntu 18.04 Bionic Beaver Linux.
Operating System and Software Versions
- Operating System: - Ubuntu 18.04 Bionic Beaver
RequirementsPrivileged access to your Ubuntu System as root or via
sudocommand is required.
- # - requires given linux commands to be executed with root privileges either directly as a root user or by use of
- $ - requires given linux commands to be executed as a regular non-privileged user
Install Python 3 on UbuntuTo install Python 3 version on your Ubuntu system execute the following linux command. If the
sudocommand is not available on your system and you are already logged in as a
sudocommand can be omitted:
$ sudo apt install python3-minimalThe above will provide you with a minimal installation of Python 3 interpreter. Check your Python version:
$ python3 -V Python 3.6.4+
Install Python 2 on UbuntuTo install Python 2 version on Ubuntu 18.04 enter:
$ sudo apt install python-minimalCheck installed python version:
$ python --version Python 2.7.14+
Install Python modulesMany Python modules are already part of the Ubuntu repository. To search for Python modules enter:
$ apt search MODULE-NAMETo install any particular python module, first obtain the package name of the module you wish to install using the above command and then run the following linux command to install it:
$ sudo apt install MODULE-PACKAGE-NAMEAlternatively, visit the following page if you need to install PIP tool for managing Python packages.