Associate Python Files with IDLE
To make it easier to open files directly into IDLE from Windows Explorer, you can associate all Python files with IDLE in Windows. As IDLE doesn’t come up as one of the default options for editing Python, it’s not as intuitive as it might be, but it’s pretty simple. Here’s how you do it:
To associate Python files with IDLE on Windows:
- Go to a folder that contains a Python file.
- Right-click on any Python file.
- Select Properties.
- Next to the section that says “Opens with”, click the Change button.
- You may need to select More Options.
- Click Look for another app on this PC.
- Navigate to where you installed Python. If you don’t know where that is, see How to find all your Python installations on Windows.
- Open Lib
- Open idlelib
- Select the idle.bat file.
- Click Open.
- Click OK to close out of Properties.
- Now you can open .py files in IDLE simply by double-clicking on them.
Related Articles
- Understanding Python’s __main__ variable
- How to find all your Python installations on Windows (and Mac)
- Associate Python Files with IDLE (this article)
- Python Virtual Environments with venv
- Mapping python to Python 3 on Your Mac