Cx_Freeze and Plotly

北城以北 提交于 2019-12-02 08:07:09

Ok, I figured it out. You can include the files in the setup.py. First create the list of files to include, like in the normal includes. python_dir is the path to your python directory that contains the files.

zip_includes = [('%s\Lib\site-packages\plotly\offline\plotly.min.js' % str(python_dir), 'plotly\offline\plotly.min.js'),
                ('%s\Lib\site-packages\plotly\widgets\graphWidget.js' % str(python_dir), 'plotly\widgets\graphWidget.js'),
                ('%s\Lib\site-packages\plotly\graph_reference\default-schema.json' % str(python_dir), 'plotly\graph_reference\default-schema.json')]

Then in your setup:

setup(name="Orion",
      version="1,
      author="Jonathan",
      description="Metering analysis tool",
      options={'build_exe': {'excludes': excludes, 'packages': packages, 'include_files': include_files, 'build_exe': "%s/build" % BASE_PATH, 'zip_includes': zip_includes}},
      executables=[compileTarget]
      )

This will include the files inside the library.zip and will not include them like the typical external files to include.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!