How to Install and Configure Python and VSCode
Python is one of the most used programming languages nowadays. It can be used to create many different types of applications, like websites, desktop application, artificial intelligence, games and even mobile development.
Here at Neps, we have a course that will teach you all the basics about this programming language, it is called Python Bootcamp. One of the first classes will teach you how to install and configure Python and Visual Studio Code (VSCode) on a Windows machine, so you can start your journey to become a Python programmer.
Installing the development environment is usually the hardest and most tedious task when learning a new programming technology. Let’s get it done quickly so we can start developing our applications in Python 😄
Let’s get started! The first step is installing Python 3 in our system. To do that, go to the Python website, you will find some versions available, it is recommended that you download the latest version.
Just double-click the downloaded file to start the installation. We recommend installing it with the default options. However, if you decide to customize the installation, make sure that you are installing pip, since it will allow us to easily install Python packages. Also, make sure to mark Add Python to PATH.
Additionally, agree to disable the path length limit to avoid problems in the future.
To install VSCode, go to the website and download the appropriated version based on your operating system.
Just double-click the downloaded file and install it in your desired folder.
It is recommended that you mark both “Open with Code” options since it allows you to open VSCode directly in the folder that you are working in.
Now you can launch the VSCode. It should look like the image below.
To create our first Python program hit CTRL + N to create a new file and save it using CTRL + S. Save the file using the “.py” extension (we are naming our file “test.py”) and VSCode will activate the Python extension for your file.
Now we can write our first Python program. Write the following source code:
print("Hello Neps Academy!")
To execute the file, open a new terminal (command line) and navigate to the folder where you salved the file (using the cd command followed by the path):
Now you can execute your file using:
Adding the Python Extension
Installing the Python extension will add even more functionalities when working with Python in VSCode. Go to the sidebar and click in Extensions, then search for “Python”, click in Install.
Now you can easily change your Python interpreter on the bottom (Figure 10) and run your code by just clicking on the run button on top (Figure 11).
- You can open the VSCode in a specific folder using the Open in Code command. Just right click on the folder (be careful to not click in a file, see the image) that you are working on and choose to open on VSCode.
- VSCode is super customizable. So you probably should spend some time making your VSCode exactly the way that you like. You can start going to Preferences -> Settings.
- While VSCode is our favourite, there are many IDEs for Python development; another solid option is PyCharm created by JetBrains.
That is it! You just installed and configured your Python IDE; now you are ready to start coding in Python!
I hope you enjoyed this guide. If you really want to get into programming, you should consider taking a look at our courses, especially our Python Bootcamp course. For more content about programming and to learn more about new tools and libraries stay tuned to our Blog, we will be posting more content soon!
Have a fantastic day!