简体   繁体   中英

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

and thanks for the support.

I am trying to build a .exe using cxFreeze. Python version 3.7 on 64bit windows machine. The building process ends pretty well, and I have my .exe file. The problem is when I try to run the .exe and I end up with this error in figure:

[![Error Message][1]][1] [1]: https://i.stack.imgur.com/kdknx.png

Basically last line:

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

makes me think that the problem could be into an incorrect import of skimage into the .exe lib list. This is my CXFreeze setup:

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

Thanks for your help!

It looks like you are using skimage, but not including it. You should (at least) do for skimage what you do for SciPy here:

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

So:

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

Disclaimer: I'm not familiar with cxFreeze, but I presume this is how it finds compiled binaries, of which scikit-image has a few.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM