Introduction to Python, installation of the environment


 

 

Let's get straight to the point without any long introductions!

 

Environment

 

1. Due to the fact that many subsequent tutorials will cover the topic of Python, let's start with its installation and some environment in which we will be coding. I assume that if you are reading this tutorial, your only editor is called Notepad, and while you can do something with Notepad++, something bigger will come in handy. It may seem unimportant, but only over time will you notice how much the environment you use can make your work easier or harder. In my opinion, the best free option that I can recommend is Visual Studio Code, which you can download here:

https://code.visualstudio.com/

 

Python

 

1. Over time, you will figure out which version you need. At the beginning, don't download a version that is too new, as tutorials you watch online may be based on an older version, and not everything will work as intended. For the purposes of this tutorial, I choose version 3.9. We can download Python from the website: https://www.python.org/.

2. Run the downloaded installer as an administrator.

3. Select "Add Python 3.9 to PATH".

4. Choose the location for installation that interests us. For ease of use and installation of other versions in the future, we choose a personalized path by clicking "Customize installation" and then "Next".

5. In "Customize install location", we choose the disk, then create a "Python" directory and within it, according to the version, "Python39", and click "Install". This way, in the future, we will install subsequent versions in the "Python" directory and keep it organized. It is possible to do it using the default installation, but in my opinion, this method is more accessible. Finally, click "Close".

6. Open the PowerShell console and type:

python --version

 

If you did everything correctly, the installed version number will be displayed.

 

7. We will make it easier to call Python by adding a shortcut to the console, and here we will use the editor mentioned earlier. While remaining in the console, we type:

code $profile

This should create a file named Microsoft.PowerShell_profile.ps1 located in C:\Users\YourUsername\Documents\WindowsPowerShell\ or in a different documents location if the default was changed.

 

8. We create an alias at the end of the file using the path chosen for Python installation. In my case, it will be the following line:

Set-Alias py "C:\Python\Python39\python.exe"

 

 

9. We save the changes and restart the console. Now we will use py instead of python to run Python scripts. You can check this by typing in the console:

py --version

 

You have installed Python and an editor. In the following tutorials, you will learn the basics of using this language in practice. Don't worry, you won't see any "Hello world!" type tutorials from me. Only meat! Programs that can actually be useful.

See you in the next tutorial!

 

How do you rate this article?

3


Chainable.it
Chainable.it

I am an experienced programmer who has recently started creating tutorials on various topics within the IT world. In my tutorials, I cover topics such as PHP, JavaScript, Python, HTML, CSS, PowerShell, Windows, Linux, and AI.


chainable. how to code
chainable. how to code

From layman to geek. All IT aspects in one place. How to code, how to use blockchain and other stuff.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.