Dash Problem in Python

Asked

Viewed 69 times

0

I’m trying to run this application on my laptop (Macbook air), and when I go to Terminal it does not run, but when it runs on a windows PC I have no problems

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)

colors = {
    'background': '#111111',
    'text': '#7FDBFF'
}

app.layout = html.Div(style={'backgroundColor': colors['background']}, children=[
    html.H1(
        children='Hello Dash',
        style={
            'textAlign': 'center',
            'color': colors['text']
        }
    ),

    html.Div(children='Dash: A web application framework for Python.', style={
        'textAlign': 'center',
        'color': colors['text']
    }),

    dcc.Graph(
        id='example-graph-2',
        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': {
                'plot_bgcolor': colors['background'],
                'paper_bgcolor': colors['background'],
                'font': {
                    'color': colors['text']
                }
            }
        }
    )
])

if __name__ == '__main__':
    app.run_server(debug=True)

Mensagem que aparece

  • Installed the library on Mac (with pip)? Or has some file called dash.py in your briefcase?

  • Yes, but there’s something strange when I do import Dash it matters but when I do import dash_core_components it error and says "Dash was not successfully Imported. Make sure you don’t have a file named 'Dash.py' in your Current directory. An Exception has occurred, use %tb to see the full traceback."

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.