As we all know, Notepad++ is a great editor. Many people prefer this text editor for writing and executing their code. It supports various programming languages, including the Python programming language. But many people face challenges or get stuck while running the Python file inside the notepad++ text editor. So, Let’s see how to execute or run a Python file inside the notepad++.
Run Python File Using
Run Option in Notepad++
To run the Python file from the notepad++ text editor, you have to click on the
Run option from the menu and then choose the first option -
Run... from the dropdown menu.
It will open a new window on the screen, as shown below. Alternatively, You can also press the F5 key on the keyboard to open this window.
The Program to Run dialog box, enter the below command and click on
C:\Python39\python.exe -i "$(FULL_CURRENT_PATH)"
The First parameter,
C:\Python39\python.exe, is the location where Python is installed on the system. And the last parameter is the current path of the file which you want to run. You don’t have to specify the file path; Python will automatically detect the file path you are currently running with
-i is optional. If you want to keep the command line window open even after the execution of the file, then use this option.
After that, it will open a command line window inside which your file will be executed, as shown below.
Run Python File Using PyNPP Plugin in Notepad++
You can also run Python programs with the help of a plugin provided by a notepad++ text editor called PyNPP. For that, first, go to
Plugins and select
Plugins Admin... from the dropdown.
A dialog box will open, as shown below. Now in the search box, search for
PyNPP plugin. Below you will see a list that will contain the plugin’s name and their version number. Just check the checkbox beside the
PyNPP plugin name.
After that, click on the
Install button present at the top right corner of the dialog box.
Now another dialog box will open up, so click
Yes. This will restart the notepad++ editor and install the
Now that we have successfully installed the plugin, we can run the file by pressing the Alt+Shift+F5 keys simultaneously on the keyboard. As soon as you press these buttons, a terminal window will be opened up, which will show you the output of the file as shown below.