最近,我更新到 Ubuntu 22。我使用的是 python 3.10。
在為 python 安裝 matplotlib 和其他必需的庫之后,我正在嘗試繪制一些圖表。
每次我在運行我的代碼時遇到這個錯誤。我遵循了 stackoverflow 或 Google 中給出的所有解決方案,但沒有運氣。
這是我得到的錯誤:
File ~/.local/lib/python3.10/site-packages/prettyplotlib/_eventplot.py:3, in <module>
1 __author__ = 'jgosmann'
----> 3 from matplotlib.cbook import iterable
5 from prettyplotlib.utils import remove_chartjunk, maybe_get_ax
6 from prettyplotlib.colors import set2
ImportError: cannot import name 'iterable' from 'matplotlib.cbook'
當我匯入 matplotlib 時,沒有問題。
我怎樣才能擺脫這個錯誤?任何幫助或建議將不勝感激。
謝謝
uj5u.com熱心網友回復:
從https://github.com/matplotlib/matplotlib/commit/08dc21b038e43401652fed765288bb669abb8b0c#diff-734998909c4e54bce8138043e769bea5654259de61cc909be9d84b04485cdae9R46看來,這已經被洗掉了。
評論建議使用numpy.iterable()
所以我想你需要改變:
from matplotlib.cbook import iterable
到
from numpy import iterable
uj5u.com熱心網友回復:
如果有人尋找解決此問題的答案,
然后按照以下步驟操作:
步驟 1)完全卸載 matplotlib 步驟 2)然后安裝 matplotlib: pip3 install -U scikit-learn scipy matplotlib
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/473879.html
標籤:Python python-3.x matplotlib ubuntu 可迭代的
上一篇:如何創建時鐘極坐標圖?
下一篇:如何控制注釋箭頭
