#python #matplotlib
Вопрос:
Я настроил виртуальную среду с Python 3.9.2 и pip 21.0.1 и установил matplotlib(3.4.1). Но при импорте библиотеки
import matplotlib.pyplot as plt
Возникает ошибка-
Traceback (most recent call last):
File "G:MachineLearningtut3.py", line 1, in <module>
import matplotlib.pyplot as plt
File "G:MachineLearningmachinelearninglibsite-packagesmatplotlibpyplot.py", line 2469, in <module>
switch_backend(rcParams["backend"])
File "G:MachineLearningmachinelearninglibsite-packagesmatplotlib__init__.py", line 619, in __getitem__
plt.switch_backend(rcsetup._auto_backend_sentinel)
File "G:MachineLearningmachinelearninglibsite-packagesmatplotlibpyplot.py", line 257, in switch_backend
switch_backend(candidate)
File "G:MachineLearningmachinelearninglibsite-packagesmatplotlibpyplot.py", line 277, in switch_backend
class backend_mod(matplotlib.backend_bases._Backend):
File "G:MachineLearningmachinelearninglibsite-packagesmatplotlibpyplot.py", line 278, in backend_mod
locals().update(vars(importlib.import_module(backend_name)))
File "C:UsersHPminiconda3libimportlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "G:MachineLearningmachinelearninglibsite-packagesmatplotlibbackendsbackend_qt5agg.py", line 11, in <module>
from .backend_qt5 import (
File "G:MachineLearningmachinelearninglibsite-packagesmatplotlibbackendsbackend_qt5.py", line 13, in <module>
import matplotlib.backends.qt_editor.figureoptions as figureoptions
File "G:MachineLearningmachinelearninglibsite-packagesmatplotlibbackendsqt_editorfigureoptions.py", line 11, in <module>
from matplotlib.backends.qt_compat import QtGui
File "G:MachineLearningmachinelearninglibsite-packagesmatplotlibbackendsqt_compat.py", line 174, in <module>
_setup()
File "G:MachineLearningmachinelearninglibsite-packagesmatplotlibbackendsqt_compat.py", line 134, in _setup_pyqt4
_setup_pyqt4_internal(api=2)
File "G:MachineLearningmachinelearninglibsite-packagesmatplotlibbackendsqt_compat.py", line 117, in _setup_pyqt4_internal
sip.setapi(_sip_api, api)
AttributeError: module 'sip' has no attribute 'setapi'
Я попытался понизить рейтинг matplotlib и numpy, но та же ошибка продолжает появляться. Это пакеты, установленные в виртуальной среде —
cycler==0.10.0
kiwisolver==1.3.1
matplotlib==3.4.1
numpy==1.18.5
pandas==1.2.4
Pillow==8.2.0
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2021.1
six==1.15.0
Может ли кто-нибудь помочь мне в этом вопросе?