In the command line window or Shell window of Linux, Windows, and Mac OS, execute the python command to start the Python interactive interpreter. The interactive interpreter will wait for the user to enter Python statements. Enter a Python statement and press Enter, the interpreter will execute the statement and output the result. The interactive interpreter is a better tool for learning Python language. The advantage is that you can get immediate feedback when you enter Python sentences.
Start the interactive interpreter in the Windows environment
There are two ways to start the Python interactive interpreter on Windows. The first way is to enter the Pyhton installation directory and run the python.exe program directly; the second way is to enter the Windows command line window and start python.exe in the command line window.
To start the Python interactive interpreter in the Windows command line window, you first need to add the path of the Python installation directory to the Path system environment variable. Otherwise, you can only enter the Python installation directory to start the interactive interpreter. When installing Python3.7, if the [Add Python3.7 to PATH] option is checked, the installation program will automatically add the Python installation directory to the Path system environment variable.
Enter the Windows command line window, enter the python command to start the interactive interpreter, enter the python statement and execute it, as shown in the figure below.
Use the IDLE integrated development environment provided by Python
Pyhton itself provides a simple integrated development environment with basic IDE functions. Use IDLE to create, run, test and debug Python programs more conveniently.
Windows and Mac OS launch IDLE
There are many ways to start IDLE in Winodws environment, you can start IDLE through shortcut menu, desktop icon, enter Python installation directory and run IDLE directly.
Mac OS starts IDLE in the same way as the interactive interpreter. It can be started directly in the Python installation directory, or it can be started by entering the open /usr/bin/idle command in a terminal window.
Simple use of IDLE
IDLE itself is a Python shell, you can directly input and execute Python statements in the IDLE window, IDLE automatically typeset and highlight the keywords. As shown below.
IDLE can also save, open and execute code files.
Content expansion:
The call of the module in python will be posted later on the basis of the modification in the original reprinted literature.
For friends who have just come into contact with a new programming language, it is important to run the program first. At least you can have a good understanding of the language.
To run a python script, there are several aspects to achieve:
Run directly on the command line:
There are different operating system platforms, mainly windows, linux, unix and other systems.
For windows: In the DOS window, enter python to enter the python running window, and then write code in it.
So far, this article on the opening methods in different python systems is introduced. For more related python opening methods, please search for the previous articles of ZaLou.Cn or continue to browse the related articles below. Hope you will support ZaLou.Cn more in the future. !
Recommended Posts