最近我的计算机更新到Windows 10,现在pyinstaller抛出错误。只要我记得,这一直在我的Windows 7计算机上工作。
我尝试卸载并重新安装pyinstaller,win32扩展以及其他一些内容。
我的计算机设置可能出现什么问题?
pyinstaller ZENTRAUtility.spec
328 INFO: PyInstaller: 3.3.1
328 INFO: Python: 2.7.14
328 INFO: Platform: Windows-10-10.0.16299
331 INFO: UPX is not available.
332 INFO: Extending PYTHONPATH with paths
['C:\\Users\\mthornbrugh\\PycharmProjects\\ZentraUtility',
'C:\\Users\\mthornbrugh\\PycharmProjects\\ZentraUtility']
332 INFO: checking Analysis
347 INFO: Building because out00-Analysis.toc is bad
348 INFO: Initializing module dependency graph...
351 INFO: Initializing module graph hooks...
430 INFO: running Analysis out00-Analysis.toc
431 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final
executable
required by c:\python27\python.exe
525 INFO: Found
...
...
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "c:\python27\lib\site-packages\PyInstaller\utils\win32\winutils.py",
line 103, in import_pywin32_module
name=module_name, globals={}, locals={}, fromlist=[''])
ImportError: No module named pywintypes
29585 INFO: Loading module hook "hook-setuptools.py"...
29631 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
29634 INFO: Excluding import 'FixTk'
29635 INFO: Excluding import 'Tkinter'
29638 INFO: Loading module hook "hook-encodings.py"...
30174 INFO: Loading module hook "hook-reportlab.pdfbase._fontdata.py"...
30234 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
30236 INFO: Loading module hook "hook-numpy.core.py"...
30318 INFO: Loading module hook "hook-wx.lib.pubsub.py"...
30561 INFO: Loading module hook "hook-win32com.py"...
31109 INFO: Loading module hook "hook-pythoncom.py"...
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "c:\python27\lib\site-packages\PyInstaller\utils\win32\winutils.py",
line 103, in import_pywin32_module
name=module_name, globals={}, locals={}, fromlist=[''])
File "c:\python27\lib\site-packages\pythoncom.py", line 2, in <module>
import pywintypes
ImportError: No module named pywintypes
31572 INFO: Loading module hook "hook-reportlab.lib.utils.py"...
31630 INFO: Looking for ctypes DLLs
31723 INFO: Analyzing run-time hooks ...
31736 INFO: Including run-time hook 'pyi_rth__tkinter.py'
31739 INFO: Including run-time hook 'pyi_rth_pkgres.py'
31742 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
31743 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
31773 INFO: Looking for dynamic libraries
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pyinstaller.exe\__main__.py", line 9, in
<module>
File "c:\python27\lib\site-packages\PyInstaller\__main__.py", line 94, in
run
run_build(pyi_config, spec_file, **vars(args))
File "c:\python27\lib\site-packages\PyInstaller\__main__.py", line 46, in
run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py",
line 791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'),
kw.get('clean_build'))
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py",
line 737, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py",
line 213, in __init__
self.__postinit__()
File "c:\python27\lib\site-packages\PyInstaller\building\datastruct.py",
line 161, in __postinit__
self.assemble()
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py",
line 537, in assemble
redirects=self.binding_redirects))
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line
222, in Dependencies
for ftocnm, fn in getAssemblyFiles(pth, manifest, redirects):
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line
400, in getAssemblyFiles
for assembly in getAssemblies(pth):
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line
351, in getAssemblies
res = GetManifestResources(pth)
File "c:\python27\lib\site-
packages\PyInstaller\utils\win32\winmanifest.py", line 1005, in
GetManifestResources
return winresource.GetResources(filename, [RT_MANIFEST], names,
languages)
File "c:\python27\lib\site-
packages\PyInstaller\utils\win32\winresource.py", line 168, in GetResources
hsrc = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE)
pywintypes.error: (1006, 'LoadLibraryEx', 'The volume for a file has been
externally altered so that the opened file is no longer valid.')
答案 0 :(得分:0)
我遇到了同样的问题。这是由于Pyinstaller在处理源目录中的文件时非常贪婪造成的,因此它遍历并拾取了不适当的内容,例如框架的子目录,例如.git
,或者在我的情况下为.vscode
。这可能会导致一些难以调试的问题-请参见https://stackoverflow.com/a/58195896/1603969。
我解决了问题,方法是将源文件复制到一个干净的目录中,然后从该干净的目录中生成一个捆绑包,其中仅包含必需的源文件。