Traceback (most recent call last):
File "<string>", line 1, in <module>
File py_installer/PyInstaller-2.1/PyInstaller/loader/pyi_importers.py", line 270, in load_module
File py_installer/PyInstaller-2.1/FaceMatcher/build/FaceMatcher/out00-PYZ.pyz/proj_code", line 11, in <module>
File PyInstaller-2.1/PyInstaller/loader/pyi_importers.py", line 270, in load_module
File PyInstaller-2.1/FaceMatcher/build/FaceMatcher/out00-PYZ.pyz/skimage.transform", line 1, in <module>
File py_installer/PyInstaller-2.1/PyInstaller/loader/pyi_importers.py", line 270, in load_module
File py_installer/PyInstaller-2.1/FaceMatcher/build/FaceMatcher/out00-PYZ.pyz/skimage.transform.hough_transform", line 7, in <module>
File py_installer/PyInstaller-2.1/PyInstaller/loader/pyi_importers.py", line 409, in load_module
File "_hough_transform.pyx", line 13, in init skimage.transform._hough_transform (skimage/transform/_hough_transform.c:7337)
File "py_installer/PyInstaller-2.1/PyInstaller/loader/pyi_importers.py", line 270, in load_module
File "py_installer/PyInstaller-2.1/FaceMatcher/build/FaceMatcher/out00-PYZ.pyz/skimage.draw", line 1, in <module>
File "py_installer/PyInstaller-2.1/PyInstaller/loader/pyi_importers.py", line 409, in load_module
File "_draw.pyx", line 1, in init skimage.draw._draw (skimage/draw/_draw.c:7257)
ImportError: No module named geometry
我遇到了上述错误。有人可以告诉我如何解决它?
答案 0 :(得分:5)
问题是skimage.transform需要一个小链条&#39; hidden imports。这些是以Pyinstaller无法自动检测的各种方式进行的导入,即使用__import__
等。因此,您必须直接告诉Pyinstaller这些导入,以便它知道检查它们并将它们添加到您的构建中。
您可以通过两种方式执行此操作:
例如,根据您的具体情况,您可以创建一个名为hook-skimage.transform.py的文件,并在其中添加以下内容:
hiddenimports = ['skimage.draw.draw',
'skimage.draw._draw',
'skimage.draw.draw3d',
'skimage._shared.geometry',
'skimage._shared.interpolation',
'skimage.filter.rank.core_cy']
您可能不需要指定所有这些模块。您的构建只缺少skimage._shared.geometry,因此您可以尝试仅使用--hidden-import命令行标志包含该文件,或者仅在hook-skimage.transform.py文件中包含skimage._shared.geometry。但是,那些特定的隐藏导入修复了我的方案在Windows 7 64位上使用skimage 0.9.3。
然后,告诉pyinstaller在哪里寻找额外的钩子文件。因此,如果您将hook-skimage.transform.py文件放在&#39;。&#39;您需要修改pyinstaller build命令以包含--additional-hooks-dir=.
这将导致pyinstaller在尝试导入skimage.transform.hough_line作为您提到的输出时检查您指定的模块。