CXFreeze: ModuleNotFoundError: No module named 'skimage.feature._orb_descriptor_positions'

CXFreeze: ModuleNotFoundError: No module named 'skimage.feature._orb_descriptor_positions'

感谢支持。

我正在尝试使用 cxFreeze 构建 .exe。 Python 64 位 windows 机器上的版本 3.7。构建过程结束得很好,我有了我的 .exe 文件。问题是当我尝试 运行 .exe 时,我最终得到了图中的这个错误:

[![错误信息][1]][1] [1]: https://i.stack.imgur.com/kdknx.png

基本上最后一行:

ModuleNotFoundError: No module named 'skimage.feature._orb_descriptor_positions'

让我认为问题可能出在错误地将 skimage 导入 .exe 库列表中。 这是我的 CXFreeze 设置:

from cx_Freeze import setup, Executable
import os
import scipy
# NOTE: you can include any other necessary external imports here aswell
os.chdir(os.getcwd())
 
includefiles = [] # include any files here that you wish
scipy_path = os.path.dirname(scipy.__file__)
includefiles.append(scipy_path)
includes = []
#excludes = ['pandas', 'numpy', 'scipy', 'PyQt4', 'PySide', 'Tkinter', 'PIL']
excludes = ['pandas',"matplotlib.tests", "numpy.random._examples"]
packages = ['_mssql', 'uuid']

exe = Executable(
 # what to build
   script = "main_gui.py", # the name of your main python script goes here 
   initScript = None,
   base = None, # if creating a GUI instead of a console app, type "Win32GUI"
   targetName = "main_gui.exe", # this is the name of the executable file
   #copyDependentFiles = True,
   #compress = True,
   #appendScriptToExe = True,
   #appendScriptToLibrary = True,
   icon = None # if you want to use an icon file, specify the file name here
)
 
setup(
 # the actual setup & the definition of other misc. info
    name = "main_gui", # program name
    version = "0.1",
    description = 'test',
    author = "test",
    author_email = "test@test.com",
    options = {"build_exe": {"excludes":excludes,"packages":packages,
      "include_files":includefiles, "optimize": 0}},
    executables = [exe]
)

感谢您的帮助!

看起来你正在使用 skimage,但没有包含它。你应该(至少)为 skimage 做你为 SciPy 做的事情:

scipy_path = os.path.dirname(scipy.__file__)
includefiles.append(scipy_path)

所以:

import skimage
skimage_path = os.path.dirname(skimage.__file__)
includefiles.append(skimage_path)

免责声明:我不熟悉 cxFreeze,但我认为这就是它查找编译二进制文件的方式,其中 scikit-image 有一些。