预安全导入模块挂钩后的PyInstaller最大递归错误[six.moves]

时间:2018-04-28 11:59:49

标签: python exe python-3.5 pyinstaller six

我正在尝试使用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:\Users\Keren Meron\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\ast.py", line 245, in visit
    return visitor(node)
File "C:\Users\Keren Meron\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\ast.py", line 253, in generic_visit
    self.visit(item)
File "C:\Users\Keren Meron\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\ast.py", line 245, in visit
    return visitor(node)
RecursionError: maximum recursion depth exceeded

回溯之前的输出(DEBUG和INFO已打开):

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'

请帮助,我需要做些什么来解决这个问题?

谢谢

3 个答案:

答案 0 :(得分:2)

这可能为时已晚,但我也遇到了这个问题,并通过在顶部的规范文件中添加几行代码来解决此问题:

# -*- mode: python -*-
import sys
sys.setrecursionlimit(5000)

block_cipher = None

希望它也可以解决您的问题,如果它仍然打开!

答案 1 :(得分:0)

尝试以下命令来强制重新安装!

pip install --force-reinstall --no-binary :all: pyinstaller

答案 2 :(得分:0)

pip install --upgrade setuptools

希望这可以解决您的问题。