0

我在尝试冻结 vispy 应用程序时遇到问题。

这是错误:

cx_Freeze: Python error in main script
---------------------------
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>
    exec(code, m.__dict__)
  File "console_example.py", line 14, in <module>
  File "C:\Python34\lib\site-packages\vispy\scene\visuals.py", line 41, in __init__
    subclass.__init__(self, *args, **kwargs)
  File "C:\Python34\lib\site-packages\vispy\visuals\text\text.py", line 380, in __init__
    self._font = self._font_manager.get_font(face, bold, italic)
  File "C:\Python34\lib\site-packages\vispy\visuals\text\text.py", line 127, in get_font
    self._fonts[key] = TextureFont(font, self._renderer)
  File "C:\Python34\lib\site-packages\vispy\visuals\text\text.py", line 45, in __init__
    self._kernel = np.load(op.join(_data_dir, 'spatial-filters.npy'))
  File "C:\Python34\lib\site-packages\numpy\lib\npyio.py", line 369, in load
    fid = open(file, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '*snip*\\build\\exe.win32-3.4\\library.zip\\vispy\\io\\_data\\spatial-filters.npy'

我看到了这个并检查了它引用的文件是否包含在 library.zip 中。不是,所以我将 cx_freeze setup.py 更改为如下所示:

import sys
from cx_Freeze import setup, Executable


build_exe_options = {"packages": ["pyglet", "vispy"],
                     "includes": ["vispy.app.backends._pyglet"],
                     "zip_includes": [("C:\\Python34\\Lib\\site-packages\\vispy\\io\\_data\\spatial-filters.npy",
                                       "vispy/io/_data/spatial-filters.npy")]}

base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(name = "Test",
      version = "0.1",
      description = "Test",
      options = {"build_exe": build_exe_options},
      executables = [Executable("console_example.py", base=base)])

现在,来自 _data 的 spatial-filters.npy 文件位于应位于的 library.zip 中,但错误仍然存​​在。我还需要做什么?

4

0 回答 0