0
votes

I want to run the following script, named test.py, from Notepad++

import numpy as np
import matplotlib.pyplot as plt 

my_x = np.arange(1,11,1)
my_y = my_x ** 2

plt.plot(my_x, my_y)
plt.show()

It works when I open cmd and run python test.py, it shows the plot in a seperate window.

When I run from Notepad++ (with NppExec set up) it keeps running and I can't see the plot anywhere.

Do I need a plug-in for this? Or is this simply not possible and should I just run from command prompt?

2

2 Answers

0
votes

matplotlib works well with Notepad++ in my computer

first check if "python" is added to your path environment variable

in Notepad++, click "Run"(or enter F5) and enter

cmd /k python "$(FULL_CURRENT_PATH)" & ECHO. & PAUSE & EXIT

in the popup window

then click ok

wish that might help

-1
votes

Yes, cmd /k python "$(FULL_CURRENT_PATH)" & ECHO. & PAUSE & EXIT truly work, but I just before use python $(FILE_NAME) was OK on another python codes, while can't work with matplotlib, how about this?