簡體   English   中英

導入 matplotlib 時出現以下錯誤

[英]I am getting the error below while importing matplotlib

File c:\Users\USER\OneDrive\Desktop\Python\lib\site-packages\matplotlib\__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:\Users\USER\OneDrive\Desktop\Python\lib\site-packages\matplotlib\cbook\__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'

在虛擬環境中嘗試這個,理想情況下它應該在那里工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM