Tutorial How To Install Python 3.9 On Debian 9 And Debian 10. Python is pre-installed on most Linux distributions and available as a package on all others. Once a new version is released, users need to learn how to install and use it. To experience all these guides well, choose your perfect VPS Server package, and buy one.
Tutorial Install Python 3.9 On Debian 9 And Debian 10
The good news is that whether you’re new to programming or an experienced developer, it’s easy to learn and use Python. Let’s review the three below steps to get sure of my word.
Step 1: Set Up Python 3.9 On Debian 9 And Debian 10
You need to update and upgrade the system to work with the Advanced Packaging Tool. To do this you can use apt command.
sudo apt update sudo apt -y upgrade
To check that the version of Python 3 that is installed in the system or not, you can use the below command when the process of step 1 is complete.
Step 2: Set Up a Virtual Environment
You can set separate dependencies for each of your projects, that’s why you buy the VPS environments to prevent disrupting your other projects. Another benefit is greater control over your Python projects and over how different versions of packages are handled.
You can use the venv module, which is part of the standard Python 3 library.
sudo apt install -y python3-venv
After the installation, you can create environments and choose which directory you would like to put your Python programming environments in or create a new directory with mkdir, as in:
mkdir environments cd environments
Create an environment when you are in the directory where you would like the environments to live.
python3.9 -m venv my_env
What is pyvenv? pyvenv sets up a new directory that contains a few items
Step 3: How To Create ”Hello, World!” Program
You are ready to create a traditional “Hello, World!” program as you have now your virtual environment set up. To test your environment and provide the opportunity to become more familiar with Python if you aren’t already, you can do this by opening a command-line text editor such as nano and create a new file:
(my_env) [email protected];~/environments$ nano hello.py
You can type out your program when the text file opens up in the terminal.
To exit nano, type the CTRL and X keys and press y to save when you are prompted. And finally, once you exit out of nano and return to your shell, let’s run the program:
(my_env) [email protected];~/environments$ python hello.py
To leave the environment, simply type the command deactivate and you will return to your original directory.
In this article, you reviewed how to install the python 3.9 on two recent versions of Debian. In this way, you know how to install the latest release without interfering with the stable version provided by your distribution. Also, you can read more on Python 3.6 installation tutorial in Debian 9.