Setting up Python Development Environment
In this lesson, you will learn about setting up Python Development Environment so that you can start developing python application using various IDE(Integrated development environment)
- How to download and install Python?
- Followed by how to get the installed python version in the command line?
- How to use IDLE and IDE and print ‘Hello World’?
- How to install Thonny IDE?
- Creating python projects in Visual studio 2022
- How to use CodersEditor.com?
How to download and install Python?
Let us learn how to download and install python on your local machine, which is the first step in setting up your Python development environment.
How to download python?
- First, visit org/downloads.
- You can see the option for downloading Python’s latest version right up on the page.
- You can download Python for Windows/Linux/Unix/macOS or other operating systems.
- Click on the Download button, and a .exe file starts downloading.
- You can even download specific versions by scrolling down on the webpage.
How to Install Python?
- After the file is downloaded click on the file and select open.
- A pop-up menu pops up, you can install the standard version or you can customise it based on your need. For beginners, the standard version is recommended.
- Select the “Install Now” option.
- The installing window pops up showing the progression of the installation process.
- When the installation is complete, a menu with a “Setup was successful” message appears.
- Now, you have completed the installation process.
How to get the installed python version in the command line?
Now let us learn to get the installed python version in the command line.
- In windows, open your command prompt.
- In the search option in the taskbar, type CMD and press enter. This will open the command prompt
- Now, in the command prompt type “Python” and press enter.
- The command prompt will display the latest version installed in your system.
How to use IDLE and IDE and print ‘Hello World’?
The next step in setting up your Python development environment is to download an IDE or to use an IDLE.
- IDLE stands for Integrated Development and Learning Environment
- IDE stands for Integrated Development Environment
To open an IDLE and print ‘Hello World’
- If you are a Windows 10 or 11 users, search IDLE in the search option on your taskbar.
- Open the IDLE file.
- Now, to print the ‘Hello world’ statement, all you need to do is type the given code directly in the IDLE
print (“Hello World”)
- When you press enter, the print statement will be printed.
Now, to use an IDE we need to understand what an IDE is and how it works.
IDE stands for Integrated Development Environment. It integrates multiple tools for the sole purpose of software development. It includes tools for code execution, debugging, building, an editor and source control.
There are multiple IDEs and Code editors available in the market which supports python. The best of them being Pycharm which is entirely built using python, Visual studio code, Eclipse+PyDev, Thonny IDE an IDE for beginners.
How to install Thonny IDE?
Let us learn how to install and use Thonny IDE.
- Visit https://thonny.org/ to download the IDE.
- On the top right of the page, you can see the download option for windows.
- Click on the windows option and the file starts downloading.
- After the download is complete, double click on the file.
- The setup menu appears, choose the option and click enter.
- Click on next until you see the progression bar.
- When the installation is complete, the success window appears.
- Click finish, now you have successfully installed the Thonny IDE.
Now let’s execute a simple program for printing Hello world using the Thonny IDE.
- First, open the application by double-clicking the icon on your desktop window.
- When you are using it for the first time, it will ask for your language of choice.
- Choose your language and click “Let’s go”.
- The appearance of the main screen of the application will be similar to this
- The top section is where you enter your code.
- The result/output will be shown in the Shell section now, enter the following code in the top section or the file section
To run the file,
- You can click on the file menu>save>file name> and then run the file by clicking on the run option in the menu.
- Whenever you try running a file, python prompts you to save the file.
- After saving the file, you can even press F5 to run the file.
- The code is executed in the shell column.
Creating python projects in Visual studio 2022
If you use the Visual Studio 2022 IDE, follow these steps to create a project in visual studio 2022:
‘Project’ is how Visual Studio organizes all the files under the project that jointly produce a single application.
Application files include source code, resources, and configurations.
- Open the Visual Studio application, select File > New > Project.
- You can use the shortcut by pressing Ctrl+Shift+N.
- The Create a new project screen appears.
- In this window, we can search and browse the required template across different languages.
- We can search for Python templates, by searching ‘python’ in the search option.
- Choose your template, and select Next.
- On the Configure your new project screen, mention your project name and file location for the project and then select Create.
That’s how you create a new project in Visual Studio 2022.
CodersEditor.com – How you can run Python code in the browser?
It is always not necessary to download an IDE to setup the python development environment. You can use a number of online compilers to execute your code.
The most popular online compiling platform is CodersEditors.com. It is the most used and preferred online compiling platform and it is absolutely free. This free online compiler and IDE allows the developers to try out more than 60+ languages without having to install IDE or code editors on their machines.
Steps to run a Python Code in CodersEditor:
- Visit CodersEditor website
- You can see the select programming language search bar in the top right corner of your page.
- Click on the dropdown and choose python language.
- The left part of your screen is where you enter your python scripts.
- Above that, you can find multiple options like New file, download, Share, Run Program. Each option has its own feature by name.
- The right top section is where you enter your inputs and the bottom screen is where you can see the output.
For instance, run the following code in the script section and press F9/ click on the run program option.