[Solved] TclError: couldn‘t connect to display “localhost:11.0“

How to Solve Error: TclError: couldn‘t connect to display “localhost:11.0“

If there is

import matplotlib as mpl

Error will be reported when the server runs

The details are as follows:

couldn’t connect to display “localhost:11.0”

Solution:

mpl.use('Agg')

Read More: