今天(2021年3月30日(我升级了matplotlib和seaborn包。
但是,在那之后,我无法导入matplotlib和seaborn包。
每当我尝试导入matplotlib或seaborn时,我收到如下错误消息。
我该如何解决这个问题?
(我使用JupyterLab 3.0(
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-33-a0d2faabd9e9> in <module>
----> 1 import matplotlib.pyplot as plt
C:devanaconda3libsite-packagesmatplotlib__init__.py in <module>
819 # triggering resolution of _auto_backend_sentinel.
820 rcParamsDefault = _rc_params_in_file(
--> 821 cbook._get_data_path("matplotlibrc"),
822 # Strip leading comment.
823 transform=lambda line: line[1:] if line.startswith("#") else line,
C:devanaconda3libsite-packagesmatplotlibcbook__init__.py in _get_data_path(*args)
478 if opened:
479 with fh:
--> 480 yield fh
481 else:
482 yield fh
AttributeError: module 'matplotlib' has no attribute 'get_data_path'
这类错误是版本冲突的典型错误,尤其是在您最近升级的情况下。
一个常见的错误是只升级一个包,而期望其他一切都能继续工作。某些版本的库只与其他库的某些版本兼容,等等。现实是,你必须找到所有库作为一个整体的工作组合。从您的示例中,不可能知道出了什么问题,但我认为您还必须升级maptplotlib依赖项,可能还有它们的依赖项。
如果您不太熟悉这些库,那么很难找到它,所以您可能会通过pip
或其他具有依赖性的包管理器重新安装所有内容。