首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何解决使用NameError时未定义“plotly_version”的“simple_plotly”问题?

如何解决使用NameError时未定义“plotly_version”的“simple_plotly”问题?
EN

Stack Overflow用户
提问于 2019-07-03 12:07:05
回答 1查看 1.6K关注 0票数 0

我正试图为我的硕士论文代码绘制一张地图。到目前为止,我只是在尝试一个来自maps.ipynb的例子,所以我认为一切都应该正常工作。但是,当尝试使用"simple_plotly“函数时,会出现一个NameError。我怎样才能使它发挥作用?

这是我得到错误的行:

代码语言:javascript
复制
from pandapower.plotting.plotly import simple_plotly
from pandapower.networks import mv_oberrhein
net = mv_oberrhein()
simple_plotly(net, on_map=True, projection='epsg:31467')

错误

代码语言:javascript
复制
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-8-9381f16ca1ad> in <module>()
      9 
     10 net = mv_oberrhein()
---> 11 simple_plotly(net, on_map=True, projection='epsg:31467')

~/miniconda3/lib/python3.6/site-packages/pandapower/plotting/plotly/simple_plotly.py in simple_plotly(net, respect_switches, use_line_geodata, on_map, projection, map_style, figsize, aspectratio, line_width, bus_size, ext_grid_size, bus_color, line_color, trafo_color, ext_grid_color)
    116         **ext_grid_color** (String, 'yellow') - External Grid Color. Init is yellow
    117     """
--> 118     version_check()
    119     # create geocoord if none are available
    120     if 'line_geodata' not in net:

~/miniconda3/lib/python3.6/site-packages/pandapower/plotting/plotly/traces.py in version_check()
     33 
     34 def version_check():
---> 35     if version.parse(plotly_version) < version.parse("3.1.1"):
     36         raise UserWarning("Your plotly version {} is no longer supported.\r\n"
     37                           "Please upgrade your python-plotly installation, "

NameError: name 'plotly_version' is not defined
EN

回答 1

Stack Overflow用户

发布于 2019-07-07 10:40:14

发生此错误是因为没有巧妙地安装,请使用pip安装ploty,它将工作。

代码语言:javascript
复制
Pip install plotly
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56869806

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档