Notepad++ seems to be stuck on Python27

  • Hello! So, apparently, my Notepad++ is very stubborn. It doesn’t want to switch to Python3, which is what I need for my latest project. Is there any way to switch it over? Maybe deleting Python2?

    Also, if it’s important, Python3 was added to the PATH, and Python2 was not. Also, they are in entirely different file locations. I don’t need Python2 anymore.

  • Notepad++ doesn’t “use” Python directly. Do you mean that the Python Script plugin, which uses Python 2.7 under the hood to automate tasks within Notepad++, and shouldn’t affect the version of Python your scripts use? Or do you mean you are using NPP as the text editor and/or simple development environment for your Python development – in which case, I assume you had some macros (Plugins > NppExec scripts, Run > Run to execute this file, or similar) or a standalone plugin that automatically ran your script thru the Python 2.7 interpreter and put the output in a “console”-like window either within NPP or as an external cmd.exe window.

    If you’re talking about the Python Script plugin, I know it ships with its own Python DLL, but you can point it to another; I don’t know if it’s compatible with Python3.

    If you’re talking about Run > Run > cmd /c $(FULL_CURRENT_PATH), then it’s making use of your OS’s automatic file type association with Python. The same is true if you’ve got a Plugins > NppExec > Execute > [pulldown to script name] that runs something like my “RunMyself” (and which I have placed in the Macro shortcut menu with NppExec > Advanced Options > Menu Items, and have added a shortcut using the Settings > Shortcut Mapper > Plugin Commands):

    cmd /c "$(FULL_CURRENT_PATH)"

    … To fix either Run > Run or an NppExec script, you either need to re-associate your python files with the new Python3 executable, or you need to edit your Run or NppExec commands to use a full path to your Python3 executable, instead of just trying to execute the source file directly. (for example, change cmd /c "$(FULL_CURRENT_PATH)" to cmd /c c:\path\to\python3.exe "$(FULL_CURRENT_PATH))

    If you’re talking about some other plugin that you use to run your python code from within NPP, you’ll need to give more details.

    If you really have python2 still on your computer, and none of the above work, and you truly “don’t need Python2 anymore”, have you tried uninstalling Python2?

    But all of these are just guesses; more details would help us help you.

  • @PeterJones said:

    cmd /c c:\path\to\python3.exe "$(FULL_CURRENT_PATH)

    Alright, so I asked my computer science teacher this question earlier, and I now have a more precise question to ask. And it is, how do I change the path from Python27 to Python35?

  • Do you mean how to change Window’s PATH variable from pointing to Python27 to Python35? That’s a Windows question, not a Notepad++ question, and one that your original post implied you knew how to do. And 30seconds on your favorite search engine will tell you: search for “change path WindowsN” (where N is 7, 8, or 10, as appropriate for your machine).

    If you mean how to change the path in the command snippet I showed, instead of typing c:\path\to\python3.exe, you would type the actual path to your installation of python3. I cannot know where that is on your computer (though c:\python35\python.exe is my first guess)

    If you mean something else, you’ll have to be more explicit. Because, once again, you haven’t said how you previously ran python27 from NPP, and other than a copy/paste of my text, haven’t shown what you’ve tried to get python35 to work.

Log in to reply