How to Run a Python Script via a File or the Shell
How to Run a Python Script via a File or the Shell
If you can not do or do a Python paper, then the programming does not happen. If you manage Python script, change the angle of the Python program on the computer can be understood. Running Python programs can be made in two ways: call Python interpreter by shebang line, and use Python's shell
Run a Python Script as a File
Typically, write letters are alone, he lives in a free environment. Then it is thrown onto the "extension", indicating that the operating system and program is actually the Python program. After the transcripts are sent, the file is read and can be interpreted. How does the Python script work in Windows compared to the Unix-based operating system is very different. I will show you the difference, and how to make a Python message on Windows and Unix programs.
Make a Python script and a Windows message
Windows users should blow through the program through the Python interpreter. As follows:
C:\Python27\python.exe C:\Users\Username\Desktop\my_python_script.py
Window's python.exe vs pythonw.exe
Note that Windows comes with two python executables - python.exe to pythonw.exe. If you want the terminal to pop-up when the script inserts, python.exe even if you do not want all the terminal pop-up, which is pythonw.exe. Pythonw.exe is generally used in the graphic design program, which you just want to show on your program, not the terminal.
Create Python on Mac, Linux, BSD, Unix, etc.
On ten games, such as Mac, Linux or BSD (Unix) you can make a line "shebang" as the first queue of the program shows where Python's translation is very difficult. In this way:
#!/path/to/interpreter
The Shebang line used by the Python Public translation is as follows:
#!/usr/bin/env python
Then, you must control the text, use the following instructions:
Comments
Post a Comment