Python Jupyter笔记本中运行Dash的问题
我只是从以下位置复制并粘贴第一批代码: 到我的Jupyter笔记本,这是我得到的:Python Jupyter笔记本中运行Dash的问题,python,jupyter-notebook,plotly,google-colaboratory,plotly-dash,Python,Jupyter Notebook,Plotly,Google Colaboratory,Plotly Dash,我只是从以下位置复制并粘贴第一批代码: 到我的Jupyter笔记本,这是我得到的: # -*- coding: utf-8 -*- import dash import dash_core_components as dcc import dash_html_components as html external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, ext
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),
html.Div(children='''
Dash: A web application framework for Python.
'''),
dcc.Graph(
id='example-graph',
figure={
'data': [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
],
'layout': {
'title': 'Dash Data Visualization'
}
}
)
])
if __name__ == '__main__':
app.run_server(debug=True)
继续运行
调试器PIN:124-434-522
调试器PIN:124-434-522
调试器PIN:124-434-522
调试器PIN:124-434-522
*服务瓶应用程序“\uuuuu main\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
*环境:生产
警告:不要在生产环境中使用开发服务器。
改用生产WSGI服务器。
*调试模式:打开
发生异常,请使用%tb查看完整回溯。
系统退出:1
任何帮助都将不胜感激
(更新评论)
我也试过谷歌可乐。不幸的是,它也不起作用。这就是我得到的:
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),
html.Div(children='''
Dash: A web application framework for Python.
'''),
dcc.Graph(
id='example-graph',
figure={
'data': [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
],
'layout': {
'title': 'Dash Data Visualization'
}
}
)
])
if __name__ == '__main__':
app.run_server(debug=True)
ModuleNotFoundError回溯(上次最近调用)
在()
---->1进口破折号
2将仪表板核心部件作为dcc导入
3以html格式导入dash_html_组件
4.
5外部_样式表=['']
ModuleNotFoundError:没有名为“dash”的模块
(第二次更新)
我在Atom中运行相同的脚本。不幸的是,它似乎不起作用:
我不明白我做错了什么。这是您正在寻找的教程。正如Alexander所解释的,Dash是一个web服务器。如果您只是在学习python,并且希望使用Jupyter绘制内容,那么运行Web服务器并不是您所需要的。相反,您必须安装绘图库,如
plotly
或我最喜欢的matplotlib
。要安装它,您需要运行!pip从Jupyter内部以绘图方式安装
。本教程将引导您完成此过程。您的最后一张照片显示dash工作得非常好
转到终端中指示的URL