In this video, we will learn how to install Python 3 on Ubuntu Desktop Operating system, using two most popular methods.
In the first method, we will use Ubuntu's default package manager called "APT" to download and install from a Package repository. This method is preferred to setup Python, on a development machine.
In the second method, we will download the source files from PSF's python.org, compile them and build binaries. This method is preferred to setup Python on a secure and critical environment, like Production Server.
Now there are two ways to proceed from here. You can just pick a method & use the commands provided below. Just copy, paste and run them in your terminal one by one, and you will have a working setup on your system. You can do this, if you have some basic understanding about how Linux based systems work.
But if you new to the Linux world, then I strongly recommend you to go through the full video. Because we will touch and discuss lot of things in there while giving you a rundown of all the commands used in the process. We will learn about APT package manager, repositories (repos), environment variables, executables and lot more. I am hoping it would be worth investing your valuable time going through the full video.
Method 1 : Install Python 3 using APT package manager (From PPA)
i. Update the system's local repo list
sudo apt update
ii. Install a pre-requisite package called "software-properties-common"
sudo apt install software-properties-common
iii. Add deadsnakes PPA to the system's repository list
sudo add-apt-repository ppa:deadsnakes/ppa
iv. Again update the system's local repo list
sudo apt update
v. Install latest patch version of Python 3.10
sudo apt install python3.10
vi. To verify installation of Python 3
python3.10 --version
Method 2 : Install Python 3 from source files ( From PSF's python.org)
i. Update the system's local repo list
sudo apt update
ii. Install supporting softwares (packages)
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
iii. Create a directory
mkdir /tmp/python
cd /tmp/python
iv. Download the Latest Version of Python Source Code
wget https://www.python.org/ftp/python/3.1...
v. Extract compressed files
tar -xvf Python-3.10.5.tgz
vi. Configure & Optimize Python for building
./configure --enable-optimizations
vii. Build Python binaries
make -j 8
viii. To install as a second instance of Python
sudo make altinstall
ix. Verify Python Version
python3.10 --version
Python Specific commands :
1. To check version of Python :
python3 --version
2. To enter into the Interactive mode (REPL) of Python :
python3
3. To quit from the Python terminal :
quit()
exit()
Keyboard shortcut : Ctrl + Z
Basic Linux/Unix commands :
1. To clear the terminal
clear
2. To create a new directory :
mkdir directory-name
3. To change working directory :
cd directory-path
4. To print out the value stored in a variable like PATH :
echo $PATH
5. To create an alias to an executable :
alias alias-name=exe-file-name
6. To check the location (directory) in which an executable is located :
which exe-name
type exe-name
7. To open up the terminal :
Shortcut : Ctrl + Alt + t
Auf dieser Seite können Sie das Online-Video Install Python 3 in Ubuntu (Linux based) mit der Dauer 16 minuten 40 sekunde in guter Qualität ansehen, das der Benutzer Sifting Bytes 23 Juli 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,305 Mal angesehen und es wurde von 23 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!