When the code published on github etc. is based on the assumption that there is a display, a display error occurs and it does not work! Write a memo about what to do in such a case.
Both methods have matplotlib in the background and can reduce errors.
Write as follows in the python code.
import matplotlib
matplotlib.use("Agg")
File name: matplotlibrc
Create a text file (without extension) and write the following character string in the file.
backend:Agg
Save this file locally (create it if it doesn't exist)
For Linux
home/usename/.matplotlib
Since it was an environment where only CUI could be used, I investigated a workaround several years ago. The latter method may cause an accident if you forget the setting, so the former method is recommended. Don't rely on plt.show (). I want you to stop.
Recommended Posts