Traceback (most recent call last):
File "/home/lhw/Gradute/jyq/eval/examples/lpipSeq/test.py", line 9, in <module>
from matplotlib.pylab import *
File "/home/lhw/anaconda3/envs/matting/lib/python3.9/site-packages/matplotlib/pylab.py", line 35, in <module>
from matplotlib import cbook, mlab, pyplot as plt
File "/home/lhw/anaconda3/envs/matting/lib/python3.9/site-packages/matplotlib/pyplot.py", line 2230, in <module>
switch_backend(rcParams["backend"])
File "/home/lhw/anaconda3/envs/matting/lib/python3.9/site-packages/matplotlib/__init__.py", line 672, in __getitem__
plt.switch_backend(rcsetup._auto_backend_sentinel)
File "/home/lhw/anaconda3/envs/matting/lib/python3.9/site-packages/matplotlib/pyplot.py", line 247, in switch_backend
switch_backend(candidate)
File "/home/lhw/anaconda3/envs/matting/lib/python3.9/site-packages/matplotlib/pyplot.py", line 267, in switch_backend
class backend_mod(matplotlib.backend_bases._Backend):
File "/home/lhw/anaconda3/envs/matting/lib/python3.9/site-packages/matplotlib/pyplot.py", line 268, in backend_mod
locals().update(vars(importlib.import_module(backend_name)))
File "/home/lhw/anaconda3/envs/matting/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/lhw/anaconda3/envs/matting/lib/python3.9/site-packages/matplotlib/backends/backend_qtagg.py", line 12, in <module>
from .backend_qt import (
File "/home/lhw/anaconda3/envs/matting/lib/python3.9/site-packages/matplotlib/backends/backend_qt.py", line 73, in <module>
_MODIFIER_KEYS = [
File "/home/lhw/anaconda3/envs/matting/lib/python3.9/site-packages/matplotlib/backends/backend_qt.py", line 74, in <listcomp>
(_to_int(getattr(_enum("QtCore.Qt.KeyboardModifier"), mod)),
TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier'
解决方案:将matplot升级到3.6.2以上版本
pip install matplotlib==3.6.2
标签:matplot,TypeError,py,number,matplotlib,lhw,home,line,backend
From: https://www.cnblogs.com/xiaohuidi/p/17056225.html