gpt4 book ai didi

python - 开始使用plotly时导入报错

转载 作者:行者123 更新时间:2023-11-28 20:44:49 25 4
gpt4 key购买 nike

我正在根据此处的教程尝试使用 plotly:http://nbviewer.ipython.org/github/plotly/python-user-guide/blob/master/s00_homepage/s00_homepage.ipynb

似乎有正确的库和 Python 版本,尽管我在 plotly 导入时遇到了 AttributeError。想知道是否有人遇到同样的问题,请参阅下面的版本和堆栈跟踪:

Python 2.7.5+ (default, Feb 27 2014, 19:37:08) 
Type "copyright", "credits" or "license" for more information.

IPython 2.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

In [1]: import numpy

In [2]: numpy.__version__
Out[2]: '1.8.1'

In [3]: import pandas

In [4]: pandas.__version__
Out[4]: '0.13.1'

In [5]: import plotly
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-5-c27a4132ad2e> in <module>()
----> 1 import plotly

/usr/local/lib/python2.7/dist-packages/plotly/__init__.py in <module>()
29 from __future__ import absolute_import
30
---> 31 from plotly import plotly, graph_objs, tools, utils
32 from plotly.version import __version__

/usr/local/lib/python2.7/dist-packages/plotly/plotly/__init__.py in <module>()
10 from __future__ import absolute_import
11
---> 12 from plotly.plotly.plotly import *
13
14 __all__ = ["sign_in", "update_plot_options", "get_plot_options",

/usr/local/lib/python2.7/dist-packages/plotly/plotly/plotly.py in <module>()
27 from plotly.plotly import chunked_requests
28 from plotly import utils
---> 29 from plotly import tools
30 from plotly import exceptions
31 from plotly import version

/usr/local/lib/python2.7/dist-packages/plotly/tools.py in <module>()
18 from plotly import exceptions
19
---> 20 from . graph_objs import graph_objs
21
22 # Warning format

/usr/local/lib/python2.7/dist-packages/plotly/graph_objs/__init__.py in <module>()
10 from __future__ import absolute_import
11
---> 12 from plotly.graph_objs.graph_objs import *
13
14 __all__ = ["Data",

/usr/local/lib/python2.7/dist-packages/plotly/graph_objs/graph_objs.py in <module>()
279 return super(DictMeta, mcs).__new__(mcs, name, bases, attrs)
280
--> 281 @six.add_metaclass(ListMeta)
282 class PlotlyList(list):
283 """A container for PlotlyDicts, inherits from standard list.

AttributeError: 'module' object has no attribute 'add_metaclass'

最佳答案

我遇到了类似的错误,按照上面 Mark 的说明,pip install --upgrade plotly 对我有用。

关于python - 开始使用plotly时导入报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25342701/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com