Advance

How to Install Python 3.9 On Debian 9 And Debian 10

How to Install Python 3.9 On Eldernode Debian 9 And Debian 10
1
(2)

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.

Recommended Article: How to install R on Ubuntu 20.04

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.

python3 -V

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

ls my_env

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) noodi@debian;~/environments$ nano hello.py

You can type out your program when the text file opens up in the terminal.

print("Hello, World!")

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) noodi@debian;~/environments$  python hello.py

To leave the environment, simply type the command deactivate and you will return to your original directory.

Conclusion

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.

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 2

No votes so far! Be the first to rate this post.

View More Posts
Tom Veitch
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

10 thoughts on “How to Install Python 3.9 On Debian 9 And Debian 10

    1. You need find it manually by checking the PYTHONPATH variable contents to find the directories from where these built in modules are being imported. Also by typing the “python -v” line tells you what is being imported and from where

    1. The Public Python 3 modules must be installed in the system Python 3 modules directory, /usr/lib/python3/dist-packages

    1. Since you’re installing multiple versions of Python, you probably want to be able to control which one your command line will open by default, which is harder to do if both versions are being added to your PATH

Leave a Reply

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

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day