How to run Python code on Notepad++

I recently installed Python on my Windows 7 machine and I was browsing online for an editor which I could use to write and run Python code. I came across Notepad++ which I incidentally had worked on a couple of years back and thought why not. The steps I followed to complete the process are as follows:

1. First install Python for your respective OS. Mine was Windows 7 and I downloaded and installed version 3.7.1 from

2. Next install the latest Notepad++ version. The version which I downloaded at the time of writing this article was Notepad++ 7.5.9

3. Notepad++ had a very good option of installing plugins using the “Plugin Manager” which are needed by yourself. Earlier version used to come with this option but it seems like it has been disabled from 7.5.x on wards. If you need to install any plugin then you will need to download it and copy the DLL to the plugins directory in the Notepad++ installation directory. For the purpose at hand we need to install the NPPExec plugin.

4. After downloading the relevant files relevant to your OS you will need to browse to the Notepad++ installation directory where you will see the plugins folder. Create the folder NPPExec and copy the NPPExec.dll file into that folder. Check the attached snap shot.

5. Restart Notepad++ and you will see the NPPExec menu item under the Plugins menu. Click on the Execute menu item after expanding the NPPExec sub menu.

6. After clicking it you will see a popup where you will need to enter macro code which will tell Notepad++ how to execute the Python scripts.

7. Then enter the following macro code into the box you see in Step 6.

{Replace this with path to your python.exe file} “$(FILE_NAME)”

Please enter the correct path of your Python executable above before saving the macro.

8. After entering the code above click on Save and you will be prompted to provided a name for the macro. I have entered “Run Python”. You can enter anything else which will help you identify that this will execute Python scripts in Notepad++.

9. Next go back in to the Plugins -> NPPExec sub menu and this time click on the Advanced Options menu item.

10. A popup will appear. Enter the name of the menu item which will appear under the Macros menu. I have chosen to enter “Run Python”. Select the name of the macro from the drop down below. After doing this click on the Add/Modify button.

11. After clicking on the button you will see the option entered appear in the box above. Let the checkbox remain checked. This will tell Notepad++ to add another menu item “Run Python” under the Macros menu.

12. Next restart Notepad++ and you will see the new menu item added under the Macros menu.

13. Now write any Python script and click on the newly created macro to run the Python script.

Hope the above helped

Please follow and like us:

Be the first to comment

Leave a Reply

Your email address will not be published.