Ckend / pythondict-quant

Quant Examples Based on Backtrader.

Home Page:https://pythondict.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cerebro.plot() 画图报错 ImportError: cannot import name 'warnings'

jiangzhonglian opened this issue · comments

作者你好,你的第二个代码跑通了,就是画图报错

不知道你 cerebro和matplotlib 用的是什么版本

  File "~/gitlab/tutorials/quant/demo_2_macd.py", line 120, in main
    cerebro.plot()
  File "~/.virtualenvs/python3.6/lib/python3.6/site-packages/backtrader/cerebro.py", line 974, in plot
    from . import plot
  File "~/.virtualenvs/python3.6/lib/python3.6/site-packages/backtrader/plot/__init__.py", line 42, in <module>
    from .plot import Plot, Plot_OldSync
  File "~/.virtualenvs/python3.6/lib/python3.6/site-packages/backtrader/plot/plot.py", line 44, in <module>
    from . import locator as loc
  File "~/.virtualenvs/python3.6/lib/python3.6/site-packages/backtrader/plot/locator.py", line 35, in <module>
    from matplotlib.dates import (HOURS_PER_DAY, MIN_PER_HOUR, SEC_PER_MIN,
ImportError: cannot import name 'warnings'

问题解决了,我测试了: matplotlib-3.2.2 可以正常跑数据

image

commented

好的,很棒,我加个版本依赖