07: Setup and Installation
Setup and Installation
Python is most widely used programming in education and industry. We also can easily install it in our local machine and write code but its installation process consists of many steps. There are tons of code editors available for Python and also many tools are available online too. We can use any of them but Visual Studio Code by Microsoft is the most popular. It also provides us with freedom to use it on local machines and we understand the overall software development process in detail.
Installation
First, we have to install an editor. Visual Studio Code aka VS Code is widely popular for it. We can get it from https://code.visualstudio.com/Download
Figure 1: Download Page for VS Code
- As we are using windows 11 thus, we will download “System Installer” and x64.
- You can select the downloader according to your operating system.
- When you click on x64 button, the downloading will start automatically,
- After downloading, you will get an exe for setup.
- Version number may change for you.
- Double click and installation wizard will start.
- Go with default values and installation path.
- After installation, run the application.
- It will ask some basic settings like color scheme or something else. You can set these according to you or leave on default values.
- Finally, you will get a screen like Figure 2.
- The top bar that contains File, Edit and other menus is called Menu bar.
Figure 2: Welcome Screen of VS Code
- The left black vertical bar that contains icons is called activity bar. In this bar initially you get the first 4 icons. I have installed extra tools for my work so here are more options.
- The first icon in activity bar is called “Explorer”
- When you click on this icon the “Explorer Pan” will be appear
Figure 3: Explorer Pane in Activity Bar
- Currently we are not working on any project or file so the first option is showing “NO FOLDER OPENED”. We can manage our files and folders here.
- The central part is the “Welcome” tab. You can see file and code management options here. If you have an old project opened inside VS Code then a list of recent items will also be here.
- If you have a new installation then no item will appear in the Recent area.
- You can create your files and folders from File menu, Explorer Pan or from Welcome tab
- You can close the Welcome tab by clicking the cross X button in the tab header.
- After successful installation of VS Code, we will download and install Python interpreter from https://www.python.org/downloads .
- By default, it is showing Windows but if you are working on a different operating system then you choose accordingly.
- It will also download an exe and by double clicking you will install it.
- In installation, go with default values and complete the wizard.
VS Code
- Now we installed the Editor and Interpreter but both are different and we required a connector that helped the editor to write, interpret and execute the Python code.
- We can find this connector in Extensions.
- Open VS Code and go into the activity bar and click on the extension icon.
- It will open the extension pane
Figure 4: Installing Extension for Python
- Type “Python” in the search bar. It will take a few moments to load search results from the extension server by internet and select “Python” from Microsoft.
- VS Code will download and install the extension from Microsoft website automatically. It is not huge in size so a few seconds will consume.
- Many other extensions will automatically install by selecting this. These extensions will help to write, debug and execute the code.
- Now we are ready to work with Python.
- Just for confirmation that all things are working we create a “hello world” program.
- It is always a good practice to put all files properly, create a folder in your hard disk.
- Go to the File menu or click the Explorer icon in the activity bar and click on the open folder.
Figure 5: Opening Folder by File Menu
Figure 6: Opening Folder by Explorer
- You can open the folder by the Welcome tab.
- After opening the folder, we can see this in Explorer Pan.
- Don’t be confused with folder names written in all caps.
Figure 7: File and Folder in Explorer
- When you hover the mouse on “PYTHON” you will see the four icons. First is new file
- Click the “New File” icon.
“Hello World” Program
- A textbox will appear under the folder name.
Figure 8: Creating Python Code File
- Enter the name “hello.py” or any other name you like and press enter.
- This will create and open the file in the tab area and you can write code there.
Figure 9: Blank Code File
- Line numbers will automatically appear.
- Write the following line on line 1.
print ("Hello, World!")
Code 1: “Hello World!”. Your First Python Code
- Click “Run Without Debugging” button in Run menu or Run icon top right corner
- The option will open a new window below that’s called Terminal and you can see the output there in the red box.
- There is a lot of other text. Just ignore it.
Figure 10: Code, Execution and Output of hello.py
- Maybe your system takes a few moments on the first run. Be patient.
- If you get your “Hello World!” in the terminal, then Python is working properly.








