CXFreeze:ModuleNotFoundError:没有名为“ skimage.feature._orb_descriptor_positions”的模块

问题描述

感谢您的支持。

我正在尝试使用cxFreeze构建.exe。 64位Windows计算机上的Python版本3.7。构建过程结束得很好,并且我有我的.exe文件。问题是,当我尝试运行.exe时,最终出现图中的错误:

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

基本上最后一行:

ModuleNotFoundError:未命名模块 '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有一些。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...