How to install 64-bit Python3 under Linux

How to install 64-bit Python 3 on Linux

How to install 64-bit Python 3 on Linux

Installing 64-bit Python 3 on Linux is easy and can be done in just a few simple steps. This article will detail how to install 64-bit Python 3 on Linux.

Step 1: Download Python 3

First, download the 64-bit Python 3 installation package from the official Python website. You can directly visit https://www.python.org/downloads/ to download the latest 64-bit Python 3 installation package.

Open a terminal and use the wget command to download the Python 3 installation package. Assuming the latest version is Python 3.8.5:

wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz

After downloading, unzip the installation package:

tar -xvf Python-3.8.5.tgz

Step 2: Compile and Install Python 3

Go to the unzipped Python directory and execute the configure command to generate the configuration file:

cd Python-3.8.5
./configure --enable-optimizations

Then compile and install Python 3:

make
sudo make install

After compilation is complete, you can verify that Python 3 has been successfully installed using the following command:

python3 --version

Step 3: Set Python 3 as the default version

If both Python 2 and Python 3 are installed on your system and you want Python 3 to be the default version, you can use the following command:

make
sudo make install

line-numbers”>sudo update-alternatives –install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives –install /usr/bin/python python /usr/local/bin/python3.8 2
sudo update-alternatives –config python

Select the Python 3 option and verify that Python 3 is the default version:

python --version

The Python 3 version number should be displayed, indicating that Python 3 is the default version.

Step 4: Install pip and a virtual environment

Typically, we also need to install pip (a Python package manager) and virtual environment manager (virtualenv):

sudo apt-get install python3-pip
sudo pip3 install virtualenv

After installation, you can use pip and virtualenv to manage Python libraries and create virtual environments.

Summary

With these simple steps, we’ve successfully installed the 64-bit Python 3 on our Linux system and set it as the default version. After installing Python 3, you can start developing with Python, setting up a development environment, and running Python programs.

Leave a Reply

Your email address will not be published. Required fields are marked *