首页 > 解决方案 > 编译项目时 auto-py-to-exe 卡在 hook-gevent.py

问题描述

我正在尝试使用 auto-py-to-exe 将 python 代码转换为 exe。它卡在“正在加载模块挂钩'hook-gevent.py'......”。这是一个可重复的小例子:

import pandas as pd
from time import sleep
loading = 'LOADING...'
for i in range(10):
    print(loading[i], sep=' ', end=' ', flush=True); sleep(0.5)

input("\nHit ENTER to Continue")

这里我导入 pandas 只是为了重现错误,因为我的主代码很长,而我的主代码中主要使用了 pandas。除了 pandas auto-py-to-exe 可以很容易地为这个小代码构建 exe。pandas 版本:1.2.3 这是 auto-py-to-exe 的日志:

Running auto-py-to-exe v2.8.0
Building directory: C:\Users\e92066\AppData\Local\Temp\tmpb589umbs
Provided command: pyinstaller --noconfirm --onefile --console  "E:/Softwares/Python Web Scraping/test2.py"
Recursion Limit is set to 5000
Executing: pyinstaller --noconfirm --onefile --console E:/Softwares/Python Web Scrapping/test2.py --distpath C:\Users\e92066\AppData\Local\Temp\tmpb589umbs\application --workpath C:\Users\e92066\AppData\Local\Temp\tmpb589umbs\build --specpath C:\Users\e92066\AppData\Local\Temp\tmpb589umbs

17658 INFO: PyInstaller: 4.2
17662 INFO: Python: 3.7.6
17666 INFO: Platform: Windows-10-10.0.18362-SP0
17670 INFO: wrote C:\Users\e92066\AppData\Local\Temp\tmpb589umbs\test2.spec
17705 INFO: UPX is not available.
17708 INFO: Extending PYTHONPATH with paths
['E:\\Softwares\\Python Web Scraping',
 'C:\\Users\\e92066\\AppData\\Local\\Temp\\tmpb589umbs']
17986 INFO: checking Analysis
17989 INFO: Building Analysis because Analysis-00.toc is non existent
17991 INFO: Initializing module dependency graph...
17998 INFO: Caching module graph hooks...
18102 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
18129 INFO: Analyzing base_library.zip ...
23457 INFO: Caching module dependency graph...
23545 INFO: running Analysis Analysis-00.toc
23576 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\program files\python37\python.exe
24216 INFO: Analyzing E:\Softwares\Python Web Scrapping\test2.py
27271 INFO: Processing pre-find module path hook distutils from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
27295 INFO: distutils: retargeting to non-venv dir 'c:\\program files\\python37\\lib'
33463 INFO: Processing pre-find module path hook site from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
33480 INFO: site: retargeting to fake-dir 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\PyInstaller\\fake-modules'
35521 INFO: Processing pre-safe import module hook setuptools.extern.six.moves from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-setuptools.extern.six.moves.py'.
50999 INFO: Processing pre-safe import module hook six.moves from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-six.moves.py'.
58093 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-urllib3.packages.six.moves.py'.
75583 INFO: Processing pre-safe import module hook win32com from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py'.
95005 INFO: Processing module hooks...
95014 INFO: Loading module hook 'hook-appdirs.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
95024 INFO: Excluding import of win32com.shell.shell from module appdirs
95028 INFO: Excluding import of win32com.shell.shellcon from module appdirs
95031 INFO: Excluding import of win32com.shell from module appdirs
95036 INFO: Loading module hook 'hook-bcrypt.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
95039 INFO: Loading module hook 'hook-certifi.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
95057 INFO: Loading module hook 'hook-cryptography.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
95789 INFO: Loading module hook 'hook-docutils.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
98408 INFO: Loading module hook 'hook-eel.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
98742 INFO: Loading module hook 'hook-IPython.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
99198 INFO: Excluding import of PySide from module IPython.external.qt_loaders
99210 INFO: Excluding import of PyQt4 from module IPython.external.qt_loaders
99219 INFO: Excluding import of matplotlib.backend_bases from module IPython.core.pylabtools
99223 INFO: Excluding import of matplotlib.pyplot from module IPython.core.pylabtools
99228 INFO: Excluding import of matplotlib from module IPython.core.pylabtools
99232 INFO: Excluding import of matplotlib.figure from module IPython.core.pylabtools
99236 INFO: Excluding import of matplotlib._pylab_helpers from module IPython.core.pylabtools
99244 INFO: Excluding import of tkinter from module IPython.lib.clipboard
99255 INFO: Excluding import of PyQt5.QtCore from module IPython.external.qt_loaders
99257 INFO: Excluding import of PyQt5.sip from module IPython.external.qt_loaders
99261 INFO: Excluding import of PyQt5.QtSvg from module IPython.external.qt_loaders
99267 INFO: Excluding import of PyQt5.QtGui from module IPython.external.qt_loaders
99269 INFO: Excluding import of PyQt5.QtWidgets from module IPython.external.qt_loaders
99273 INFO: Excluding import of PyQt5 from module IPython.external.qt_loaders
99278 INFO: Loading module hook 'hook-jedi.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
100396 INFO: Loading module hook 'hook-jinja2.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
100433 INFO: Loading module hook 'hook-jsonschema.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
100486 INFO: Loading module hook 'hook-lxml.etree.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
100491 INFO: Loading module hook 'hook-lxml.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
101144 INFO: Loading module hook 'hook-nacl.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
101167 INFO: Loading module hook 'hook-nbconvert.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
101327 INFO: Loading module hook 'hook-nbformat.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
101401 INFO: Loading module hook 'hook-notebook.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
105578 INFO: Loading module hook 'hook-openpyxl.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
105759 INFO: Loading module hook 'hook-pycparser.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
105763 INFO: Loading module hook 'hook-pytest.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
107137 INFO: Loading module hook 'hook-pythoncom.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
107594 INFO: Loading module hook 'hook-pywintypes.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
108088 INFO: Loading module hook 'hook-regex.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
108092 INFO: Loading module hook 'hook-win32com.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
108794 INFO: Loading module hook 'hook-win32ctypes.core.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
109038 INFO: Loading module hook 'hook-zmq.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
109313 INFO: Loading module hook 'hook-babel.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\PyInstaller\\hooks'...
109519 INFO: Loading module hook 'hook-difflib.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\PyInstaller\\hooks'...
109540 INFO: Excluding import of doctest from module difflib
109545 INFO: Loading module hook 'hook-distutils.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\PyInstaller\\hooks'...
109556 INFO: Loading module hook 'hook-distutils.util.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\PyInstaller\\hooks'...
109569 INFO: Excluding import of lib2to3.refactor from module distutils.util
109575 INFO: Loading module hook 'hook-encodings.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\PyInstaller\\hooks'...
109646 INFO: Loading module hook 'hook-gevent.py' from 'C:\\Users\\e92066\\AppData\\Roaming\\Python\\Python37\\site-packages\\PyInstaller\\hooks'...

在这个 auto-py-to-exe 之后卡在这里。请帮忙。

标签: python-3.xauto-py-to-exe

解决方案


推荐阅读