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

标签 python plot ipython plotly

我正在根据此处的教程尝试使用 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/

相关文章:

r - 在 r 中具有 Plot_ly 的 3D 曲面,具有 x、y、z 坐标

python - 在 Pycharm Ubuntu 中添加 ipython 作为解释器

python - 猜谜游戏中输入多个相同的数字;循环停止工作?

matlab - 如何在 MATLAB 的 bar3 图中隐藏零值

python - Django 在不使用 "request.path"的情况下获取 url 路径

matlab - 如何建立数据流挖掘的滑动窗口模型?

ipython - 如何在 jupyter 笔记本中插入制表符而不是自动完成?

Python:快速将 7 GB 文本文件加载到 unicode 字符串中

python - CustomClass复制错误: AttributeError: 'CustomClass' object has no attribute 'copy'

python - MBCS 编码未知