导入matplotlib时出现以下错误


File c:UsersUSEROneDriveDesktopPythonlibsite-packagesmatplotlib__init__.py:877, in <module>
    870     return config
    873 # When constructing the global instances, we need to perform certain updates
    874 # by explicitly calling the superclass (dict.update, dict.items) to avoid
    875 # triggering resolution of _auto_backend_sentinel.
    876 rcParamsDefault = _rc_params_in_file(
--> 877     cbook._get_data_path("matplotlibrc"),
    878     # Strip leading comment.
    879     transform=lambda line: line[1:] if line.startswith("#") else line,
    880     fail_on_error=True)
    881 dict.update(rcParamsDefault, rcsetup._hardcoded_defaults)
    882 # Normally, the default matplotlibrc file contains *no* entry for backend (the
    883 # corresponding line starts with ##, not #; we fill on _auto_backend_sentinel
    884 # in that case.  However, packagers can set a different default backend
    885 # (resulting in a normal `#backend: foo` line) in which case we should *not*
    886 # fill in _auto_backend_sentinel.
File c:UsersUSEROneDriveDesktopPythonlibsite-packagesmatplotlibcbook__init__.py:518, in _get_data_path(*args)
    512 def _get_data_path(*args):
    513     """
    221     return props[name].__get__(instance)
--> 222 raise AttributeError(
    223     f"module {cls.__module__!r} has no attribute {name!r}")
AttributeError: module 'matplotlib' has no attribute 'get_data_path'

在虚拟环境中尝试一下,理想情况下应该可以在那里工作。

相关内容

最新更新