If you have decided to learn Python or have been sent a .py file then you will need to know the best ways to open a .py (python) file so you can look inside the Python file script or run a .py script you have made on your Windows 10 PC.
What Is A .PY File?
A file with an extension of .py is a file that is meant to be run in Python software or a command shell that is equipped to run Python scripts.
Python is an object-oriented programming language that is used to develop a host of different software and applications that can run on a wide range of devices such as Windows 10, Windows 11, Smartphones, Mac, Linux, and many more devices.
How To Open PY Files In Windows 10 & 11
We will be showing you how to run the latest Python version which is Python3 using a Windows-based PC.
We will show you 3 different ways, on how you can run .py files on your system with the easiest way first especially if you are looking to learn Python and have debug options when searching through the Python code.
1. Use A Python IDE On Your Windows 10 & 11 (PyCharm)<h3>
An IDE (integrated development environment) is a fancy code editor program that works on many different programming languages and is the easiest way to run .py files on Windows.
There are many IDEs for Windows but the best IDE to use would be a toss-up between Pycharm and Microsoft Visual Studio.
For the simplicity of this article especially if you are new to Python we will be recommending you pycharm community edition which is free.
1. Go to the following URL https://www.jetbrains.com/pycharm/ Then you will see a black button that says download .exe (make sure you download the free, built open source if you looking for the free version)
2. Once the pycharm free community edition has downloaded run the pycharm .exe to install the IDE.
Now after you have installed pycharm you can drag and drop your .py file into the pycharms window which will automatically open the .py file you have.
2. Use Windows 10, & 11 Command Prompt To Run .PY Files
The second way is if you do not want to use an IDE for whatever reason you can choose to use the built-in command prompt on Windows 10 & 11.
1. Go to python.org and download the python, Choose either 64-bit or 32-bit depending on your Windows 10 system.
2. Open the .exe you have just downloaded you will need to tick both the bottom boxes (especially the “Add Python 3.x to PATH“) and choose Install and wait around 5 minutes for the python to install on your Windows operating system.
That’s it You will now be able to open your Windows command prompt and type in the below code and see the Python version you are running.
3. Use Notepad++ To See The Contents Of your Python .PY File
This won’t run your .py file but if you aim to look at the contents within the .py file then you can use Notepad++ which is a more powerful notepad editor than your built-in Windows notepad.
Learn everything you need to know about Windows 2019 End Of Life (EOL).
We have just provided you with 3 ways you can run .py files in Windows 10 & 11. This can also work for previous versions of Windows such as 8 & 7 and even the upcoming unreleased version of Windows 12.