import matplotlib

import matplotlib.pyplot as plt

fig=plt.figure()

#交互式测试,此时报错

 

解决办法,在引用后添加下面这一行

matplotlib.use('Agg')

例如

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig=plt.figure()

 

相关文章:

  • 2021-05-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-25
  • 2021-07-19
  • 2022-12-23
相关资源
相似解决方案