我正在尝试使用pyinstaller将我的python3.5项目转换为.exe文件我的主要文件是segtool.py
这是我的.spec文件:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['SegTool.py'],
pathex=['consts.py', 'FetalMRI_about.py', 'FetalMRI_mainwindow.py', 'FetalMRI_workspace.py', 'image_label.py', 'main_window.py', 'scan_file.py', 'segment3d_itk.py', 'Shapes.py', 'workspace.py', 'C:\Users\Keren Meron\Documents\School Work\Fetal MRI\FetalSegBrainTool'],
binaries=[],
datas=[('images', 'images')],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_n_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='SegTool',
debug=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='SegTool')
也许我对钩子和依赖关系的理解不够相关,但是我崩溃了:
File "C:UsersKeren MeronWinPython-64bit-3.5.3.1Qt5python-3.5.3.amd64libast.py", line 245, in visit
return visitor(node)
File "C:UsersKeren MeronWinPython-64bit-3.5.3.1Qt5python-3.5.3.amd64libast.py", line 253, in generic_visit
self.visit(item)
File "C:UsersKeren MeronWinPython-64bit-3.5.3.1Qt5python-3.5.3.amd64libast.py", line 245, in visit
return visitor(node)
RecursionError: maximum recursion depth exceeded
在追溯之前,输出(调试和信息已打开(:
10923 INFO: Caching module hooks...
10937 INFO: Analyzing SegTool.py
13458 INFO: Processing pre-safe import module hook six.moves
14204 INFO: Processing pre-safe import module hook win32com
14205 DEBUG: win32com: extending __path__ with dir 'C:\Users\Keren Meron\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\site-packages\win32comext'
14604 INFO: Processing pre-find module path hook distutils
16281 INFO: Processing pre-find module path hook site
16284 INFO: site: retargeting to fake-dir 'C:\Users\Keren Meron\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\site-packages\PyInstaller\fake-modules'
40968 INFO: Processing pre-safe import module hook requests.packages.urllib3.packages.six.moves
51591 DEBUG: load_module: SyntaxError in 'C:\Users\Keren Meron\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\site-packages\jinja2\asyncsupport.py'
请帮助,我需要做什么来解决此问题?
谢谢
这可能为时已晚,但是我也遇到了这个问题,并通过在顶部的规格文件中添加几行代码来修复它:
# -*- mode: python -*-
import sys
sys.setrecursionlimit(5000)
block_cipher = None
希望,如果它仍然打开,这也可以解决您的问题!
一种可能的解决方案是使用以下命令升级setuptools:
pip install --upgrade setuptools
如果您面临着pyinstaller安装的问题,或者要更新到最新版本,则建议使用以下命令:
pip install --upgrade pyinstaller
如果它不起作用,请尝试以下命令强制重新安装!
pip install --force-reinstall --no-binary :all: pyinstaller