Sooo you would like to learn more about python, don’t you? Then you are in the right place!
To learn how to use python, you need to install it first, don’t you think? Although it is recommended to use virtual environments when it comes to any coding environment, let’s keep it simple for now and go with the installation in your personal computer.
Firstly, you need to go to https://www.python.org/downloads/ and download the latest version (at the moment I’m writing this, the latest version is 3.10.2). Since this is a tutorial designed for Windows, we’re going to download the Windows version.
Once the download is completed, we need to install it, just like you install any other piece of software, with the mention that you need to check the 2 checkboxes as shown below.
After you click all the nexts and stuff, make sure you also click on “Disable path length limit” at the end of the installation process. This is to avoid any future problems regarding passing paths into your computer’s environment.
Congratulations! Now you have python installed in your computer! But how are you going to write the code? And that’s where an IDE (Integrated Development Environment) comes into place.
Python comes with its own IDE that got installed when you installed python, but I think a more advanced IDE is required because it helps you with code suggestions, potential errors and so on, especially when you’re a beginner.
The IDE I’m using is Visual Studio Code. To install it, go to https://code.visualstudio.com/download and download the version for your OS (I’m using windows, therefore I’m downloading the windows version).
Now, let’s install it. When the setup starts, make sure you have the checkboxes checked as shown below. It will help you in the future. You can also check the “Create a desktop icon” box if you want. I’ll leave it unchecked for now as my desktop is already too full.
After the installation is completed, it would be very helpful to install some extensions that will actually help you with the predictions and suggestions. The extensions you’re looking for are Python, Jupyter and Pylance (Jupyter is not something we’ll be using right now, but we will be using Jupyter Notebook in other tutorials, especially the ones related with Machine Learning, so it’s good to have it from the beginning). First, open the extensions window by clicking on the shape similar to a square with 4 squares in the left-hand side. Then, click on the Install button next to each of the 3 extensions mentioned above.
After installation, you’ll probably be asked to reload the window to activate the extensions. Click Yes.
By default, your python version should automatically be detected by VS Code, but if not, you’ll need to specify the python interpreter (if you see the python version in the bottom bar, then you don’t need to perform the next steps).
To specify the python interpreter, click on the Settings button (it is the last button in the bottom left-hand side). Then click on Command Palette.
In the top bar write Select interpreter and click on the suggestion that appears.
You should now see all the python versions installed, if you have more than one. If not, you should see the one you installed in the beginning of this tutorial.
Now you should see the correct python version in the bottom bar. And that’s pretty much it to start working with python.
Some final notes:
It is highly recommended to create virtual environments and to install independent python version on each of them. However, for the sake of learning the basics of python and how to actually use it on a daily basis, I chose to go with an installation in your current machine.
Installing the latest version of python will keep you up to date with its syntax. However, there might be libraries you want to use that haven’t been updated to the latest version. If you somehow find yourself in this place, just install an older python version and change the interpreter in Visual Studio Code.
That’s it for now! I hope you found some valuable information here!
Other posts in this series -> Python Tutorial for Beginners