Linux · 2月 1, 2023 0

How To Install Python3 and pip On Ubuntu/Debain Linux ?


Python is popular programming and scripting language. Python3 can be installed on Ubuntu easily.

How To Install Python3 On Ubuntu?

Before starting to install Python3 we can check the Python3 installation . The -V option is used.

$ python3 -V

Installation Python3 Using apt Package Manager.

First, we update the repositories information for the software.

$ apt update

The apt install command is used to install Python3 .

$ sudo apt install python3

As Python is provided as a package we can display detailed information about the Python package.

$ apt show python3

Installation Python3 Using Source Code.

$ apt update

In this step, we install the required libraries.

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

Download the latest Python3 source code.

$ wget

$ tar -xf Python-3.10.4.tgz
$ cd Python-3.10.4/

Prepare for the compile operation.

$ ./configure --enable-optimizations

C compiler found in $PATH” we should install the gcc compiler with the following command.

$ sudo apt install gcc

The last step is the compilation and installation of Python3.

$ sudo make install

The installed Python3 version can be displayed with -V option .

$ python3 -V
Python 3.10.4

How To Install pip3 On Ubuntu?

The pip3 provides the ability to search, install, update and remove 3rd party Python packages.

The pip3 command can be installed using apt-get command. The pip3 tool can be installed with the following command.

$ sudo apt update
$ sudo apt install python3-pip

The Pip3 version installed can be displayed using the -V option .

$ pip3 -V


$ pip3 --version

The pip3 command help info can be displayed.

$ pip3 -h

%d 博主赞过: