首页 > 解决方案 > ImportError:无法从“pypfopt.plotting”导入名称“Plotting”

问题描述

我刚刚安装了 pyportfolioopt 模块,但在执行以下导入时出错

from pypfopt.plotting import Plotting

错误是

ImportError: cannot import name 'Plotting' from 'pypfopt.plotting' 

我已经从https://pyportfolioopt.readthedocs.io/en/latest/Plotting.html检查了 API,但没有看到任何名为“Plotting”的类。

请指教。

标签: pythonportfolio

解决方案


你必须使用

from pypfopt import plotting

代替

from pypfopt.plotting import Plotting


推荐阅读