本文介绍了ImportError:LinuxMint17.3中“没有名为plotly.plotly的模块"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Python新手.每当我尝试编译以下代码以获取折线图时,都会显示一些错误.但是我不知道如何解决它.这是我的代码:

I am New in Python. Whenever I am trying to compile the following code to get a line graph shows some errors. But I don't know how to fix it. Here is my code :

import plotly.plotly as py
import plotly.graph_objs as go

# Create random data with numpy
import numpy as np

N = 500
random_x = np.linspace(0, 1, N)
random_y = np.random.randn(N)

# Create a trace
 trace = go.Scatter(
x = random_x,
y = random_y
)

data = [trace]

 py.iplot(data, filename='basic-line')

显示以下错误:

mks@mks-H81M-S /media/mks/KUTUBUDDIN1/test $ python datdaPlot.py 
Traceback (most recent call last):
  File "datdaPlot.py", line 1, in <module>
    import plotly.plotly as py
 ImportError: No module named plotly.plotly
 mks@mks-H81M-S /media/mks/KUTUBUDDIN1/test $   

请帮助解决此问题.提前致谢.

Please help to fix this. Thanks in advance.

已添加:
根据Spandan Brahmbhatt的说法,我已经通过sudo pip install plotly安装了 pip .但仍然显示以下错误:

Added:
According to Spandan Brahmbhatt, I have installed pip by sudo pip install plotly. But still shows the following error:

推荐答案

您将需要先安装它们.

pip install plotly
pip install cufflinks

这篇关于ImportError:LinuxMint17.3中“没有名为plotly.plotly的模块"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 16:29