Free Quote

Find us on SAP Ariba

Please Leave a Review

AliTech Solutions

Blog

How to Install Python 3

How to Install Python 3 on Ubuntu – Step by Step Guide

How to Install Python 3 on Ubuntu – Step by Step Guide

Python is a programming language that lets you work more quickly and integrate your systems more effectively.

You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs. [1]

How to Install Python 3.10 from source:

Dependencies:

Make sure your system is updated:

sudo apt update && sudo apt upgrade

Install required dependencies:

sudo apt install wget build-essential libreadline-gplv2-dev libncursesw5-dev 
     libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev

Download the archive from Python’s official site:

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

Extract the archive:

tar xzf Python-3.10.0.tgz

Move to extracted directory:

cd Python-3.10.0 

Compile on your system

./configure --enable-optimizations 

Finally install on your system, make sure you are using altinstall command since this might replace your current Python version if you don’t use this command:

make altinstall

If that is successfully installed you can check the Python version:

python3.10 -V

or 

python3.10 --version

 

 

How to Install Python 3.10 from Repository:

Make sure your system is updated:

sudo apt update && sudo apt upgrade -y

Dependencies:

Install required dependencies:

sudo apt install software-properties-common -y

Add repository:

sudo add-apt-repository ppa:deadsnakes/ppa

CAUSION:

This is a third party repository make sure its authenticated before using.

Reporting Issues ================

Issues can be reported in the master issue tracker at: https://github.com/deadsnakes/issues/issues

Finally install Python 3.10:

sudo apt install python3.10

 

FAQs:

How to differentiate between launching Python 2 interpreter and Python 3 interpreter?

Understanding Python Interpreter Versions

When you’re working with Python, it’s common to have multiple versions installed on your system. To ensure you’re using the desired Python interpreter, it’s crucial to know how to differentiate between Python 2 and Python 3.

Launching Python 2

Typically, if both Python 2 and Python 3 are installed on your system, entering python in your console might default to the Python 2 interpreter. This is often the case, but it’s not guaranteed as it depends on how your system paths are configured.

Launching Python 3

To use Python 3, you usually need to be specific and type python3 in your console. Doing so directs the system to launch the Python 3 interpreter. This command is designed to avoid confusion and ensure that scripts meant for Python 3 are not inadvertently run with Python 2, which could lead to errors in code execution.

Knowing these commands and how they direct your system can help manage working across different Python versions more effectively.

 

How to install Python 3.8 on Ubuntu using deadsnakes PPA?

Step-by-Step Guide to Installing Python 3.8 on Ubuntu with Deadsnakes PPA

If you’re aiming to install Python 3.8 on an Ubuntu system, particularly if it’s not the initial version that came with your distribution, using the Deadsnakes PPA is a proven method. Here’s a simple guide to get you started:

Preparing Your System

First, ensure your system’s package list and the software itself are up to date. Open your terminal and execute the following commands:

  1. Update the package list:
    sudo apt-get update
    
  2. Install necessary software properties:
    sudo apt-get install software-properties-common
    

Adding the Deadsnakes PPA

To add the Deadsnakes PPA, which hosts newer releases of Python not provided by the standard Ubuntu repositories, input this command:

sudo add-apt-repository ppa:deadsnakes/ppa

After adding the PPA, update your package list again to ensure your system recognizes the new repository:

sudo apt-get update

Installing Python 3.8

With the repository ready, you can now install Python 3.8 by running:

sudo apt-get install python3.8

This command will fetch and install Python 3.8 on your Ubuntu setup.

By following these steps, you’ll have Python 3.8 installed on your Ubuntu system, ready for development work or any other project you have in mind.

 

[1] https://www.python.org/

[2] https://alitech.io [3] https://www.hostingbyalitech.com

Leave a Comment

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

Recent Posts