我正在尝试捆绑一个使用 scikits-image/skimage、numpy、scipy、wx 和 reportlab 的相当广泛的应用程序。我在 Windows 7 顺便说一句。
它似乎构建得很好:
1091 INFO: wrote C:\Users\IEUser\Desktop\pyinstaller\sasdm\sasdm.spec
1200 INFO: Testing for ability to set icons, version resources...
1923 INFO: ... resource update available
1993 INFO: UPX is not available.
12236 INFO: checking Analysis
12246 INFO: building Analysis because out00-Analysis.toc non existent
12246 INFO: running Analysis out00-Analysis.toc
12256 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executabl
e
69579 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.2
1022.8_none ...
69589 INFO: Found manifest C:\Windows\WinSxS\Manifests\x86_microsoft.vc90.crt_1f
c8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91.manifest
69640 INFO: Searching for file msvcr90.dll
69650 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b
_9.0.21022.8_none_bcb86ed6ac711f91\msvcr90.dll
69650 INFO: Searching for file msvcp90.dll
69660 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b
_9.0.21022.8_none_bcb86ed6ac711f91\msvcp90.dll
69660 INFO: Searching for file msvcm90.dll
69660 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b
_9.0.21022.8_none_bcb86ed6ac711f91\msvcm90.dll
70089 INFO: Analyzing C:\Users\IEUser\Desktop\pyinstaller\support\_pyi_bootstrap
.py
72563 INFO: Analyzing C:\Users\IEUser\Desktop\pyinstaller\PyInstaller\loader\arc
hive.py
72713 INFO: Analyzing C:\Users\IEUser\Desktop\pyinstaller\PyInstaller\loader\car
chive.py
72864 INFO: Analyzing C:\Users\IEUser\Desktop\pyinstaller\PyInstaller\loader\iu.
py
72904 INFO: Analyzing C:/Users/IEUser/Desktop/sasdm/sasdm.py
90069 INFO: checking Tree
90078 INFO: building because out00-Tree.toc missing or bad
90078 INFO: building Tree out00-Tree.toc
91530 INFO: checking Tree
91530 INFO: building because out01-Tree.toc missing or bad
91530 INFO: building Tree out01-Tree.toc
98730 INFO: Hidden import 'encodings' has been found otherwise
98742 INFO: Looking for run-time hooks
98742 INFO: Analyzing rthook C:\Users\IEUser\Desktop\pyinstaller\support/rthooks
/pyi_rth_Image.py
98772 INFO: Analyzing rthook C:\Users\IEUser\Desktop\pyinstaller\support/rthooks
/pyi_rth_PIL_Image.py
98802 INFO: Analyzing rthook C:\Users\IEUser\Desktop\pyinstaller\support/rthooks
/pyi_rth_Tkinter.py
98911 INFO: Analyzing rthook C:\Users\IEUser\Desktop\pyinstaller\support/rthooks
/pyi_rth_encodings.py
100013 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of
final executable
123457 INFO: Warnings written to C:\Users\IEUser\Desktop\pyinstaller\sasdm\build
\pyi.win32\sasdm\warnsasdm.txt
123556 INFO: checking PYZ
123556 INFO: rebuilding out00-PYZ.toc because out00-PYZ.pyz is missing
123556 INFO: building PYZ out00-PYZ.toc
155382 INFO: checking PKG
155393 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing
155393 INFO: building PKG out00-PKG.pkg
199075 INFO: checking EXE
199085 INFO: rebuilding out00-EXE.toc because sasdm.exe missing
199085 INFO: building EXE from out00-EXE.toc
199164 INFO: Appending archive to EXE C:\Users\IEUser\Desktop\pyinstaller\sasdm\
dist\sasdm.exe
但是当我尝试运行应用程序时,我遇到了以下错误:
_MEIPASS2 is NULL
archivename is C:\Users\IEUser\Desktop\pyinstaller\sasdm\dist\sasdm.exe
Extracting binaries
Executing self as child with Setting up to run child
Creating child process
Waiting for child process to finish...
_MEIPASS2 is C:/Users/IEUser/AppData/Local/Temp/_MEI39282/
archivename is C:\Users\IEUser\Desktop\pyinstaller\sasdm\dist\sasdm.exe
Already in the child - running!
manifestpath: C:/Users/IEUser/AppData/Local/Temp/_MEI39282/sasdm.exe.manifest
Activation context created
Activation context activated
C:/Users/IEUser/AppData/Local/Temp/_MEI39282/python27.dll
Manipulating evironment
PYTHONPATH=C:/Users/IEUser/AppData/Local/Temp/_MEI39282;C:/Users/IEUser/Desktop/
pyinstaller/sasdm/dist
PYTHONHOME=C:/Users/IEUser/AppData/Local/Temp/_MEI39282/
importing modules from CArchive
extracted iu
extracted struct
extracted archive
Installing import hooks
out00-PYZ.pyz
Running scripts
Traceback (most recent call last):
File "<string>", line 10, in <module>
File "C:\Users\IEUser\Desktop\pyinstaller\PyInstaller\loader\iu.py", line 386,
in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Users\IEUser\Desktop\pyinstaller\PyInstaller\loader\iu.py", line 480,
in doimport
exec co in mod.__dict__
File "C:\Users\IEUser\Desktop\pyinstaller\sasdm\build\pyi.win32\sasdm\out00-PY
Z.pyz\cell_analysis", line 13, in <module>
File "C:\Users\IEUser\Desktop\pyinstaller\PyInstaller\loader\iu.py", line 431,
in importHook
mod = self.doimport(nm, ctx, ctx + '.' + nm)
File "C:\Users\IEUser\Desktop\pyinstaller\PyInstaller\loader\iu.py", line 480,
in doimport
exec co in mod.__dict__
File "C:\Users\IEUser\Desktop\pyinstaller\sasdm\build\pyi.win32\sasdm\out00-PY
Z.pyz\skimage.data", line 11, in <module>
File "C:\Users\IEUser\Desktop\pyinstaller\PyInstaller\loader\iu.py", line 386,
in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Users\IEUser\Desktop\pyinstaller\PyInstaller\loader\iu.py", line 480,
in doimport
exec co in mod.__dict__
File "C:\Users\IEUser\Desktop\pyinstaller\sasdm\build\pyi.win32\sasdm\out00-PY
Z.pyz\skimage.io", line 76, in <module>
File "C:\Users\IEUser\Desktop\pyinstaller\sasdm\build\pyi.win32\sasdm\out00-PY
Z.pyz\skimage.io", line 56, in _update_doc
ValueError: max() arg is an empty sequence
RC: -1 from sasdm
OK.
Deactivating activation context
Releasing activation context
Done
Back to parent...
Freeing status for C:\Users\IEUser\Desktop\pyinstaller\sasdm\dist\sasdm.exe
这让我相信 skimage / scikits-image 有问题,但我对如何解决这个问题一无所知。有没有人遇到过类似的事情?
更新
我还用 py2exe 对此进行了测试,得到了以下相同的响应:
Traceback (most recent call last):
File "sasdm.py", line 10, in <module>
import cell_analysis
File "cell_analysis.pyc", line 13, in <module>
File "skimage\data\__init__.pyc", line 11, in <module>
File "skimage\io\__init__.pyc", line 76, in <module>
File "skimage\io\__init__.pyc", line 56, in _update_doc
ValueError: max() arg is an empty sequence
更新 2
我现在已经缩小了问题的范围。在 skimage/io/_plugins/plugin.py 中,skimage 将尝试通过以下方式从文件中读取其插件:
pd = os.path.dirname(__file__)
ini = glob(os.path.join(pd, '*.ini'))
但是,文件评估为一个不存在(并且看似随机命名)的目录。现在,skimage 需要将其插件文件(.ini 和 .py)包含在包中,然后在运行时需要在包中查找它们。我想第一部分可以通过收集数据文件来完成,但第二部分呢?