import matplotlib
print(matplotlib.get_backend())
#matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
print(matplotlib.get_backend())
import numpy as np
print(matplotlib.get_backend())
import pylab
print(matplotlib.get_backend())
matplotlib.use('QT5Agg')
print(matplotlib.get_backend())
import objtracker
from objdetector import Detector
import cv2
import pandas as pd
matplotlib.use('QT5Agg')
print(matplotlib.get_backend())
大体方法,在每个import之后添加print(matplotlib.get_backend())
语句,查看是哪个语句使得matplotlib.get_backend()发生了变化。我这里是import了pandas后变为了agg,所以在import pandas as pd
后面紧跟了一个matplotlib.use('QT5Agg')
,就可以正常画图了。