Installing and configuring VS Code for Python
Visual Studio Code is an excellent IDE (integrated developer environment) that you can use to help write Python code. You can download VS code from the official website at code.visualstudio.com:
Download and install VS Code by selecting the appropriate option. Since this is a Windows course, we are clicking the Windows download button on the left. Once the download completes, run the installer with the default options and start VS Code:
Here you can configure the theme you want to use, then let's create a project folder. In VS Code, clcik File > Open Folder:
Browse to the directory where you want to save your Python files for this course, right-click and click New > Folder.
Name it whatever you think is appropriate then click Select Folder:
Next, select Yes when asked about trusting the authors:
Now we can create Python files and folders inside of this directory as desired and they will all be quickly accessible from our VS Code editor. I prefer to have a folder for each project I work on in VS code - but you are free to work any way you see fit. Having a single folder for your work in this course is a great option!
Right-click in the explorer pane and select New File. Name it test.py then press Enter.
The new file will open:
Wait for the module installation to complete. This will install the Python module by Microsoft which includes IntelliSense (autocompletion), Linting, debugging and more! If you receive a Windows Security Alert, click Allow Access:
Copy and paste the following test code into the test.py file:
print("Hello Server Academy")
Now we can execute our Python files by pressing F5. Click Python File when prompted:
Now if we look in the terminal we will see our executed code:
And that's all we need to do to get started writing Python code in Visual Studio Code!