Python Forum
Matplolib graphic from batch - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/Forum-Python-Coding)
+--- Forum: Data Science (https://python-forum.io/Forum-Data-Science)
+--- Thread: Matplolib graphic from batch (/Thread-Matplolib-graphic-from-batch)



Matplolib graphic from batch - achilledue - Sep-10-2019

Hello

Sorry I don't know if is this the correct section
of the forum

I used this script taken from an example
of matplolib

The script is running from the idle but if
I run it from a batch:

<\cd \Python36
python C:\Temp_DD1\Duca\PY_dep\PlotTest.py
rem pause\>

file I got an error:
Error:
File "C:\Temp_DD1\Duca\PY_dep\PlotTest.py", line 1, in <module> import matplotlib ModuleNotFoundError: No module named 'matplotlib'
Here the code of the script:

import matplotlib
import matplotlib.pyplot as plt
import numpy as np

# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)

fig, ax = plt.subplots()
ax.plot(t, s)

ax.set(xlabel='time (s)', ylabel='voltage (mV)',
       title='About as simple as it gets, folks')
ax.grid()
fig.savefig("test.png")
plt.show()



RE: Matplolib graphic from batch - paul18fr - Sep-11-2019

I got such type of error when a package is not installed: I would say that it's your case with matplotlib (or maybe be are you using a specific distribution?)


RE: Matplolib graphic from batch - buran - Sep-11-2019

any possibility that you have more than one python installation or using virtualenvironment?