使用pyinstaller(windows)绑定应用程序时出错

2024-10-01 13:37:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试捆绑一个非常广泛的应用程序,它使用scikits image/skimage、numpy、scipy、wx和reportlab。我在Windows 7 btw上

它看起来很好:

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

但当我尝试运行应用程序时,会遇到以下错误:

^{pr2}$

这让我相信skimage/scikits图像有问题,但我不知道如何解决这个问题。有人遇到过类似的情况吗?在

更新

我还用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/\u插件中/插件.py,skimage将尝试按以下方式从文件中读取插件:

pd = os.path.dirname(__file__)
ini = glob(os.path.join(pd, '*.ini'))

但是,文件的计算结果是一个不存在的(似乎是随机命名的)目录。现在,skimage需要它的插件文件(.ini和.py)包含在包中,然后在运行时,需要在包中查找它们。我想第一部分可以通过收集数据文件来完成,但是第二部分呢?在


Tags: pyinfotreewindowsusersfiledesktoppyinstaller
1条回答
网友
1楼 · 发布于 2024-10-01 13:37:01

我也有同样的问题。我的解决方法是将Python\Lib\site包中的整个文件夹skimage复制到带有exe文件的文件夹中。

之后,我得到了一个新错误“ImportError:no module named signal”,我通过添加化学信号在构建中。

顺便说一下,以下错误:

ValueError: max() arg is an empty sequence

由我的代码中的这行触发:

^{pr2}$

相关问题 更多 >