Python Installation & Configuration
Python is a cross-platform programming language; it runs on many platforms, such as Linux, macOS, Windows, and many Unix variants.
In this tutorial, we will look at installing Python in major operating systems and configuring Python in VSCode.
Install Python on Windows
The installation is very straightforward. Follow the detailed steps mentioned below.
Step 1: Download the latest version of Python from the Official Python Website. You can also find other releases of Python and can install them from the same link.
Step 2: Double-click to run the installer. In the setup wizard, check the Add Python 3.10 to PATH checkbox to set the environment variable.
Step 3: Click on Install Now to begin the installation process. The setup will be completed in a few minutes, and you should see a successful message in the wizard.
Verify the Python Installation
To verify if the Python is installed correctly, open the command prompt and type the following command.
If Python is installed successfully, you should see the Python version and details, as shown below.
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
If Python is not installed, you will get the below error message.
'python' is not recognized as an internal or external command, operable program or batch file.
Install Python on Linux
Python will be preinstalled on most Linux Distributions such as Debian OpenSuse, Fedora, etc.
You can check if Python has been installed in your Linux OS by running the below command in the terminal.
You can also install it as a package if it's not preinstalled. For example if you want to install Python in Ubuntu, run the following commands.
$ sudo apt-get update $ sudo apt-get install python3.10
Install Python on macOS
- Download the Python release Package for macOS from the official website.
- Once the download is completed, double-click to start installing Python. Follow the setup instruction provided in the wizard to complete the installation process.
Configure Python on Visual Studio Code
In the "Extensions" tab of Visual Studio Code, search for "Python" and install the first extension that appears (the developer should be "Microsoft Team").
Many settings are available (for example, to specify flags to the compiler, the linter, etc.), but the default ones are usually enough, especially for beginners.