找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 3919|回复: 0

[求助] pyinstaller打包报错求助

1

主题

9

帖子

9

积分

贫民

积分
9
天降天使 发表于 2021-10-26 15:58:36 | 显示全部楼层 |阅读模式
pyinstaller打包exe程序时就卡在Loading module hook 'hook-gevent.py',然后就报错,重装了python和pycharm仍然不行,用另一台电脑可以正常打包,本电脑突然出现的这种问题,所有引入gevent包的都不能打包,求助大神!万分感谢!!以下为报错代码

E:\学习\pycharm>pyinstaller -F -w 协程.py
55 INFO: PyInstaller: 4.5.1
55 INFO: Python: 3.7.8
55 INFO: Platform: Windows-10-10.0.19041-SP0
56 INFO: wrote E:\学习\pycharm\协程.spec
58 INFO: UPX is not available.
59 INFO: Extending PYTHONPATH with paths
['E:\\学习\\pycharm', 'E:\\学习\\pycharm']
251 INFO: checking Analysis
251 INFO: Building Analysis because Analysis-00.toc is non existent
251 INFO: Initializing module dependency graph...
254 INFO: Caching module graph hooks...
266 INFO: Analyzing base_library.zip ...
1906 INFO: Processing pre-find module path hook distutils from 'd:\\program files (x86)\\python37\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_modu
le_path\\hook-distutils.py'.
1907 INFO: distutils: retargeting to non-venv dir 'd:\\program files (x86)\\python37\\lib'
2935 INFO: Caching module dependency graph...
3121 INFO: running Analysis Analysis-00.toc
3138 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by d:\program files (x86)\python37\python.exe
3344 INFO: Analyzing E:\学习\pycharm\协程.py
3677 INFO: Processing pre-find module path hook site from 'd:\\program files (x86)\\python37\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_pa
th\\hook-site.py'.
3678 INFO: site: retargeting to fake-dir 'd:\\program files (x86)\\python37\\lib\\site-packages\\PyInstaller\\fake-modules'
4992 INFO: Processing pre-safe import module hook setuptools.extern.six.moves from 'd:\\program files (x86)\\python37\\lib\\site-packages\\PyInstaller\\
hooks\\pre_safe_import_module\\hook-setuptools.extern.six.moves.py'.
7461 INFO: Processing module hooks...
7461 INFO: Loading module hook 'hook-pycparser.py' from 'd:\\program files (x86)\\python37\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdho
oks'...
7462 INFO: Loading module hook 'hook-difflib.py' from 'd:\\program files (x86)\\python37\\lib\\site-packages\\PyInstaller\\hooks'...
7464 INFO: Loading module hook 'hook-distutils.py' from 'd:\\program files (x86)\\python37\\lib\\site-packages\\PyInstaller\\hooks'...
7465 INFO: Loading module hook 'hook-distutils.util.py' from 'd:\\program files (x86)\\python37\\lib\\site-packages\\PyInstaller\\hooks'...
7466 INFO: Loading module hook 'hook-encodings.py' from 'd:\\program files (x86)\\python37\\lib\\site-packages\\PyInstaller\\hooks'...
7540 INFO: Loading module hook 'hook-gevent.py' from 'd:\\program files (x86)\\python37\\lib\\site-packages\\PyInstaller\\hooks'...
Traceback (most recent call last):
  File "d:\program files (x86)\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\program files (x86)\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\Program Files (x86)\python37\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\__main__.py", line 126, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\building\build_main.py", line 815, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\building\build_main.py", line 762, in build
    exec(code, spec_namespace)
  File "E:\学习\pycharm\协程.spec", line 19, in <module>
    noarchive=False)
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\building\build_main.py", line 294, in __init__
    self.__postinit__()
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\building\datastruct.py", line 159, in __postinit__
    self.assemble()
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\building\build_main.py", line 473, in assemble
    self.graph.process_post_graph_hooks(self)
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\depend\analysis.py", line 373, in process_post_graph_hooks
    module_hook.post_graph(analysis)
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\depend\imphook.py", line 451, in post_graph
    self._load_hook_module()
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\depend\imphook.py", line 409, in _load_hook_module
    self.hook_module_name, self.hook_filename)
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\compat.py", line 632, in importlib_load_source
    return mod_loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 907, in load_module
  File "<frozen importlib._bootstrap_external>", line 732, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 696, in _load
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\hooks\hook-gevent.py", line 21, in <module>
    exclude_datas=["**/tests"])
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 1157, in collect_all
    filter=filter_submodules)
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 644, in collect_submodules
    repr(pkg_dir), package))
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 98, in exec_statement
    return __exec_statement(statement, capture_stdout=True)
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 79, in __exec_statement
    return __exec_python_cmd(cmd, capture_stdout=capture_stdout)
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 70, in __exec_python_cmd
    txt = compat.exec_python(*cmd, env=pp_env)
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\compat.py", line 565, in exec_python
    return exec_command(*cmdargs, **kwargs)
  File "d:\program files (x86)\python37\lib\site-packages\PyInstaller\compat.py", line 332, in exec_command
    out = proc.communicate(timeout=60)[0]
  File "d:\program files (x86)\python37\lib\subprocess.py", line 964, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "d:\program files (x86)\python37\lib\subprocess.py", line 1298, in _communicate
    raise TimeoutExpired(self.args, orig_timeout)
subprocess.TimeoutExpired: Command '('d:\\program files (x86)\\python37\\python.exe', '-c', '\nimport sys\nimport pkgutil\nimport traceback\n\n# ``pkgut
il.walk_packages`` doesn\'t walk subpackages of zipped files\n# per https://bugs.python.org/issue14209. This is a workaround.\ndef walk_packages(path=No
ne, prefix=\'\', onerror=None):\n    def seen(p, m={}):\n        if p in m:\n            return True\n        m[p] = True\n\n    for importer, name, isp
kg in pkgutil.iter_modules(path, prefix):\n        if not name.startswith(prefix):   ## Added\n            name = prefix + name          ## Added\n
   yield importer, name, ispkg\n\n        if ispkg:\n            try:\n                __import__(name)\n            except ImportError:\n
  if onerror is not None:\n                    onerror(name)\n            except Exception:\n                if onerror is not None:\n
  onerror(name)\n                else:\n                    traceback.print_exc(file=sys.stderr)\n                    print("collect_submodules: failed
to import %r!" %\n                          name, file=sys.stderr)\n            else:\n                path = getattr(sys.modules[name], \'__path__\', N
one) or []\n\n                # don\'t traverse path items we\'ve seen before\n                path = [p for p in path if not seen(p)]\n\n
  ## Use Py2 code here. It still works in Py3.\n                for item in walk_packages(path, name+\'.\', onerror):\n                    yield item\n
               ## This is the original Py3 code.\n                #yield from walk_packages(path, name+\'.\', onerror)\n\nfor module_loader, name, ispkg
in walk_packages([\'d:\\\\program files (x86)\\\\python37\\\\lib\\\\site-packages\\\\gevent\'], \'gevent.\'):\n    print(\'\\n$_pyi:\' + name + \'*\')\
n')' timed out after 60 seconds


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表