使用 PyInstaller 运行从 plotly-dash 代码生成的 exe 文件时,我不断收到以下错误。
AttributeError: 'FrozenImporter' object has no attribute 'filename'
Run Code Online (Sandbox Code Playgroud)
做了一些深入的检查,只能识别出当 dash 尝试导入 dash_renderer并从package.filename行检索文件名时发生的属性错误
尝试添加以下但仍然无法解决
我的情节破折号代码
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(children=[
html.H2(children='H-{} Meeting Dashboard'.format("SS"), style={'text-align':'center'}),
html.Div(children=[
html.Div('''Generated on {}'''.format(str(datetime.now())[:19]), style={'text-align':'center', 'font-size':'15px'})
], className='row')]
)
if __name__ == "__main__":
app.run_server(debug=True)
Run Code Online (Sandbox Code Playgroud)
用于生成 exe 文件的 PyInstaller 代码
\path\to\python37\python.exe -m PyInstaller app_short.py
Run Code Online (Sandbox Code Playgroud)
运行 .exe 文件时出错,遇到以下错误
my\directory>app_short.exe
2019-06-25 23:36:55 Imported all …Run Code Online (Sandbox Code Playgroud)