I just wrote a small program that launches on a Mac by setting the "open with" file parameter to python launcher. How can I get the same program to run installed on a Windows desktop?
Launch Python program on PC
Collapse
X
-
In windows, there is no need for any Python launcher.
You can run python programs in two ways in windows, First by typing commands directly in a python shell or run program stored in a file.
But most of the time you want to run programs stored in a .py file.
Like a file named demo.py is saved in your documents directory i.e C:\Users\UserNa me\Documents which has following code :
Code:print('Hello! Welcome to my first Demo')
c:\Users\UserNa me\Documents>py thon demo.py
Hello! Welcome to my first Demo
If everything is ok then you will get the following output :
Code:Hello! Welcome to my first Demo
Comment
-
Run the Python command-line interpreter, under your OS of choice,
Open Command line: Start menu -> Run and type cmd.
Type: C:\python27\pyt hon.exe.
Note: This is the default path for Python 2.7. If you are using a computer where Python is not installed in this path, change the path accordingly.Comment
-
On command prompt and go to the directory where python file is stored and type and enter
Code:python "name of python file".py
Comment
Comment