Python Configure a software development environment in Python
How a program written in Python works
In general, we create an extension file .pyto put the commands that we will write in Python.
After we finish writing the commands, we need to call the Python language launcher(Python Interpreter)Until the commands placed in the file are executed line by line, as in the following image.
The code that you write is calledSource Code.
To run this code it must be sent to the Python interpreter(Python Interpreter).
The interpreter, in turn, contains the Python code interpreter(Compiler)And the python code operator(Virtual Machine).
The compiler is tasked with converting Python code into code that the computer can understand(Byte Code)And here a new copy of the file is created in the computer language, the extension .pyc.
Then the translator converts the(Byte Code)A program that runs on any operating systemWindows,Linux,MacOS.
technical terms
Source CodeIt means the source code or code, and it is also called source code.
Byte Code: The code that the machine understands, and here you find that the whole code consists of two numbers: 0 and 1 .
Compiler: is called a code compiler. Actually, it is a program that converts code written in Python toByte Code.
Virtual Machine: is the program that runs theByte CodeLike any program on the operating system.
OS: abbreviation forOperating SystemWhich means any operating system likeWindows,Linux,MacOS.
Steps to download Python language
Go to the official Python website link to download the necessary toolsclick here "
Click on the Download the latest available version button.
tap onSave Fileto start the download.
After the download is complete, open the file to begin installing the tools.
Right-click on the file, then clickRun as administrator
Check the optionInstall launcher for all usersAnd a check mark on the optionAdd Python 3.6 to Path
Then click on the . buttonInstall NowTo begin installing the tools on the device.
After the tools have been successfully installed, pressCloss.
To check if the tools have been installed successfully and that the device is able to understand the code you are writing in Python.
How to make sure that Python has been installed successfully
To see if the Python interpreter is installed and its version number, open the command prompt, which says(Command LineorCMDorTERMINAL)And run the program that runs Python commands from within by typing the command python.
How do I launch the command prompt in Windows?
Go to the main menu and type in the search box(Command Prompt)Then open it. It will appear to you as follows.
Command Prompt
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Users\user harmash>
So to find out if the Python interpreter has been installed and its version number, we write pythonand then click on the buttonEnter.
Command Prompt - python.exe
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or " license" for more information.
>>>
So the version number of Python installed on the device is 3.6.4.
After the code, >>>you can directly write commands in Python and execute them.
To exit the Python launcher, type the command exit()and click the . buttonEnter.
Command Prompt - python.exe
C:\Users\user harmash>
To exit the command prompt, type the command exitand click the . buttonEnter.
Command Prompt
Steps to download and install the programPyCharm
Enter the program download linkPyCharmFrom the official siteclick here "
Click the Download the latest available free version button.
tap onSave Fileto start the download.
After the download is complete, open the file to begin installing the tools.
Right-click on the file, then clickRun as administrator
Click the . buttonNextTo begin the program installation steps.
Click the . buttonNextTo start the installation of the program in the specified path.
Check the boxes we selected if you don't know what they mean and then click the buttonNext.
In case you know the meaning of these options, you can select whatever you like from them.
Click the . buttonNext.
Click the . buttonNextThe actual installation of the program will start in the specified path and based on the options selected.
After the program has been successfully installed, click on the . buttonFinishout.
open the . programPyCharmAnd choose the right colors
After installing the program, you can easily open the program in two ways:
The first method, is by double-clicking on the program icon that was added on the desktop (that is, on theDesktop).
The second method is to go to the main operating system menu and typePyCharmin the search box.
When you open the program for the first time it asks you to select your favorite program colors.
We recommend choosingDarculaBecause it is more comfortable to look at.
After choosing one of them, click on the buttonSkip Remaining and Set DefaultsFor you in the following picture.
Now you will notice that it will ask you if you want to create a new project.
If you want to create a new project, specify the name of the project (that is, the name of the main folder in which you will put the files) in place of the name untitledthat would have been set as the default name for the project.
At the moment do not create a project because we will do this shortly. Then press the . buttonCancel.
Steps to create a new project inPyCharm
Open the program.
Click on the iconCreate New Project.
Note: If the . programPyCharmOpen and you want to create a new project in it, go to the top menu and click onFileThen click onNew Project.
Now you find that it asks you to specify the name of the project in place of the name
untitledthat would have been set as the default name for the project.
Put any name for the project like
myappand then clickCreate.
Close the help window.
Right-click on the project name and hover over the wordNewThen click onPython FileSo you can create a new Python file in the project.
Give the file a name like
Testand then click the buttonOKUntil the file is created in the project.
Now you can write any Python code inside the
Test.py.
Write the command
print("Hello World!"in the file.Then click Ctrl+ Sto save the file.
Then click Shift+ F10to play the file.