<bdo id='cPKzM'></bdo><ul id='cPKzM'></ul>
  • <tfoot id='cPKzM'></tfoot>
    <legend id='cPKzM'><style id='cPKzM'><dir id='cPKzM'><q id='cPKzM'></q></dir></style></legend>

      1. <i id='cPKzM'><tr id='cPKzM'><dt id='cPKzM'><q id='cPKzM'><span id='cPKzM'><b id='cPKzM'><form id='cPKzM'><ins id='cPKzM'></ins><ul id='cPKzM'></ul><sub id='cPKzM'></sub></form><legend id='cPKzM'></legend><bdo id='cPKzM'><pre id='cPKzM'><center id='cPKzM'></center></pre></bdo></b><th id='cPKzM'></th></span></q></dt></tr></i><div id='cPKzM'><tfoot id='cPKzM'></tfoot><dl id='cPKzM'><fieldset id='cPKzM'></fieldset></dl></div>
      2. <small id='cPKzM'></small><noframes id='cPKzM'>

      3. Cx_Freeze 和 Plotly

        时间:2023-09-29
      4. <i id='tDgZB'><tr id='tDgZB'><dt id='tDgZB'><q id='tDgZB'><span id='tDgZB'><b id='tDgZB'><form id='tDgZB'><ins id='tDgZB'></ins><ul id='tDgZB'></ul><sub id='tDgZB'></sub></form><legend id='tDgZB'></legend><bdo id='tDgZB'><pre id='tDgZB'><center id='tDgZB'></center></pre></bdo></b><th id='tDgZB'></th></span></q></dt></tr></i><div id='tDgZB'><tfoot id='tDgZB'></tfoot><dl id='tDgZB'><fieldset id='tDgZB'></fieldset></dl></div>

          <bdo id='tDgZB'></bdo><ul id='tDgZB'></ul>
        • <legend id='tDgZB'><style id='tDgZB'><dir id='tDgZB'><q id='tDgZB'></q></dir></style></legend>

          <tfoot id='tDgZB'></tfoot>

                    <tbody id='tDgZB'></tbody>

                  <small id='tDgZB'></small><noframes id='tDgZB'>

                  本文介绍了Cx_Freeze 和 Plotly的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用 cx_freeze 构建一个应用程序的 exe.

                  I am trying to build an exe of an application that uses plotly using cx_freeze.

                  我之前使用 matplotlib 构建了应用程序,但已将绘图切换为 plotly.

                  I have previously built the application using matplotlib but have switched the graphing over to plotly.

                  我可以构建应用程序,但是当我尝试绘图时,我收到以下错误.

                  I can build the application but when I try to plot, I get the following error.

                   url = py.plot(fig, filename='pandas-box-plot')
                  
                    File "C:Python34libsite-packagesplotlyofflineoffline.py", line 284, in p
                  lot
                      get_plotlyjs(),
                    File "C:Python34libsite-packagesplotlyofflineoffline.py", line 48, in ge
                  t_plotlyjs
                      plotlyjs = resource_string('plotly', path).decode('utf-8')
                    File "C:Python34libsite-packagespkg_resources\__init__.py", line 1184, in
                  resource_string
                      self, resource_name
                    File "C:Python34libsite-packagespkg_resources\__init__.py", line 1457, in
                  get_resource_string
                      return self._get(self._fn(self.module_path, resource_name))
                    File "C:Python34libsite-packagespkg_resources\__init__.py", line 1535, in
                  _get
                      return self.loader.get_data(path)
                  OSError: [Errno 0] Error: 'plotly\offline\plotly.min.js'
                  

                  我尝试在 setup.py 文件中包含 pkg_resources,并且还在 PATH_to_exeofflineplotly.min.js 中包含了 plotly.min.js.

                  I have tried including pkg_resources in the setup.py file and have also included the plotly.min.js in the PATH_to_exeofflineplotly.min.js.

                  据我所知 pkg_resources 有问题吗?

                  As far as I can tell the pkg_resources has the problem?

                  似乎 pkg_resources 正在 library.zip 文件中查找该文件,但它包含在 library.zip 之外的路径中.我似乎找不到将文件添加到 setup.py 中的 library.zip 文件的方法

                  It seems like pkg_resources is looking for the file in the library.zip file, but it is included in the path outside of the library.zip. I can't seem to find a way to add the files to the library.zip file in the setup.py

                  感谢您的帮助.

                  推荐答案

                  好的,我想通了.您可以在 setup.py 中包含这些文件.首先创建要包含的文件列表,就像在正常包含中一样.python_dir 是包含文件的 python 目录的路径.

                  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 = [('%sLibsite-packagesplotlyofflineplotly.min.js' % str(python_dir), 'plotlyofflineplotly.min.js'),
                                  ('%sLibsite-packagesplotlywidgetsgraphWidget.js' % str(python_dir), 'plotlywidgetsgraphWidget.js'),
                                  ('%sLibsite-packagesplotlygraph_referencedefault-schema.json' % str(python_dir), 'plotlygraph_referencedefault-schema.json')]
                  

                  然后在您的设置中:

                  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]
                        )
                  

                  这将包含 library.zip 中的文件,并且不会像要包含的典型外部文件那样包含它们.

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

                  这篇关于Cx_Freeze 和 Plotly的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:情节:如何检查和更改情节人物? 下一篇:语法错误:以“xe1"开头的非 UTF-8 代码

                  相关文章

                  <i id='MXo1M'><tr id='MXo1M'><dt id='MXo1M'><q id='MXo1M'><span id='MXo1M'><b id='MXo1M'><form id='MXo1M'><ins id='MXo1M'></ins><ul id='MXo1M'></ul><sub id='MXo1M'></sub></form><legend id='MXo1M'></legend><bdo id='MXo1M'><pre id='MXo1M'><center id='MXo1M'></center></pre></bdo></b><th id='MXo1M'></th></span></q></dt></tr></i><div id='MXo1M'><tfoot id='MXo1M'></tfoot><dl id='MXo1M'><fieldset id='MXo1M'></fieldset></dl></div>

                  <small id='MXo1M'></small><noframes id='MXo1M'>

                    <legend id='MXo1M'><style id='MXo1M'><dir id='MXo1M'><q id='MXo1M'></q></dir></style></legend>

                        <bdo id='MXo1M'></bdo><ul id='MXo1M'></ul>

                    1. <tfoot id='MXo1M'></tfoot>