Back How to Run Python Programs ( .py files ) on Windows 11 ( All Options )

5-10
Created By: Example Program
Published At: 2020-06-12
Search Query: Python Get Started,Python Read Files,Python Write Create Files,Python Write Create Files
Tags: Python Python Program Python Programming Run Python Program on Windows 10 computer programming python tutorial for beginners python tutorial
In this tutorial you will learn How to run Python Programs ( .py files ) on windows 11 computer.
We can use Python command prompt and idle interactive interface or we can write the program in a simple text editor like notepad and execute the program using cmd.

We also can use IDLE to write the program, save it as a file and run it.

Download and install Python in Windows 11
https://youtu.be/DjbDQfnnKWo

our Social Media Pages
https://www.facebook.com/ExampleProgram
https://www.twitter.com/ExampleProgram
https://www.Instagram.com/example_program

Our Website
https://www.ExampleProgram.com

#ExampleProgram
logo Ask VidTutorAssistant
Comment
or
Question
Your name
Comments with generated responses
@maheshkumar3857
2020-12-12

nice but audio has slightly disturbance with some irritating noise while listening with hearphone

@ExampleProgram

My mic gave some problems that day.
I noticed that while editing.
Sorry about that.

VidTutorAssistant (GPT-4)

Hey @maheshkumar3857, I really appreciate your feedback! I'm sorry for any inconvenience you've had with the audio quality. Your input is essential and I will work on improving this area for future videos. Thank you for your support and stay tuned for more Python Programming tutorials. Your support means a lot!


@slobodanmilic1331
2021-09-03

Hello Anil,
You are excellent teacher.
Your tutorial for C/C++ is the best on YouTube, I believe the same is for Python.
Regards
Slobodan

@ExampleProgram

Thanks
will make more tutorials :)

VidTutorAssistant (GPT-4)

Hello Slobodan,
Thank you for your kind words and appreciation! I'm thrilled to hear that you found my C/C++ tutorial useful. I hope my Python tutorials also prove beneficial to you. If you ever have any queries or suggestions related to the content, feel free to drop a comment. I appreciate your support. Stay tuned for more tutorials!
Best,
Anil


@fichtltuning
2021-05-29

thank you, but when i run my file it just open and after 0,5 seccond it close. why should i do?
the code is : print ("dows this work")

@ExampleProgram

In the end of your program add the line
Input("hit enter button to exit")

VidTutorAssistant (GPT-4)

Hi @fichtltuning, sorry to hear you're having trouble. From what it sounds like, your code is executing and then the command prompt window immediately closes, so it seems like you are not having enough time to see the output. If you're running your script by double-clicking the .py file in Windows then this could be the case.

To see the output of your print statement, try running the script in a Command Prompt (cmd) window. Navigate to the location of your Python file in Command Prompt then run it using the following format: `python your_file_name.py`.

You can also add an input statement at the end of your python script, such as `input('Press ENTER to exit')`. This will hold the window open until you press the ENTER key.

Do give this a try and let me know how it goes! Happy coding!


@LaminateShark
2022-02-20

it says 'Python' is not recognized as an internal or external command,

operable program or batch file.

@ExampleProgram

if python is installed then make sure that you have set the path environment variable properly :)

VidTutorAssistant (GPT-4)

Hi @LaminateShark, I'm sorry that you're encountering this issue. This error usually arises when Python is not added to your system's PATH during installation or the system cannot find Python's PATH. Here is what you can do:

1. Reinstall Python and pay close attention and make sure to check the box that says "Add Python to PATH" during the installation process.

2. If you've already installed Python, you can manually add Python to your PATH. The process depends on the version of Windows you're using. But here's a general guide:
- Search for 'Environment Variables' in your computer's search bar and click on 'Edit the system environment variables'.
- Click the 'Environment Variables' button.
- Under 'System Variables' find 'Path' and click 'Edit'.
- In the 'Variable value:' field, add the path of your Python directory. If you don't know where Python is located, try the default locations such as: C:\Python\Python[version] or C:\Users\Username\AppData\Local\Programs\Python\Python[version] (replace [version] with the installed Python version).
- Make sure to separate this new path from any existing paths using a semicolon (;).
- Click 'OK', then 'Apply', then 'OK' again.

After making these changes, reopen your command prompt and type 'python' again. The error should be fixed now, and you should be able to run Python from your command prompt. I hope this helps. Feel free to leave any further questions or issues you're encountering. Happy coding!


@JaN-hw2pr
2023-02-09

Bro your telling dekshtop😂

@ExampleProgram

yeah. I don't know why i do that.
i am trying to fix that but still happens

VidTutorAssistant (GPT-4)

Haha, you caught me there @JaN-hw2pr 😄. I guess it's just an accent thing. Thank you for watching and keeping the environment light-hearted! Keep on learning python and do subscribe for more videos. If you have a specific topic request, do let me know. Thanks for your support!