简体   繁体   English

使用 auto-py-to-exe 将任何 python 文件转换为 exe 时出错

[英]Getting error while converting any python file to exe with auto-py-to-exe

When converting any python file to exe, I get an error将任何 python 文件转换为 exe 时,出现错误

Error processing line 1 of c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\matplotlib-3.4.2-py3.9-nspkg.pth:

Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 169, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\importlib\util.py", line 2, in <module>
    from . import abc
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\importlib\abc.py", line 17, in <module>
    from typing import Protocol, runtime_checkable
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\typing.py", line 26, in <module>
    import re as stdlib_re  # Avoid confusion with the re we export.
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 589, in <module>
    main()
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 576, in main
    known_paths = addsitepackages(known_paths)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 359, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 208, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 179, in addpackage
    import traceback
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Error processing line 1 of c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\matplotlib-3.4.2-py3.9-nspkg.pth:

Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 169, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\importlib\util.py", line 2, in <module>
    from . import abc
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\importlib\abc.py", line 17, in <module>
    from typing import Protocol, runtime_checkable
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\typing.py", line 26, in <module>
    import re as stdlib_re  # Avoid confusion with the re we export.
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 589, in <module>
    main()
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 576, in main
    known_paths = addsitepackages(known_paths)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 359, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 208, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 179, in addpackage
    import traceback
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Error processing line 1 of c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\matplotlib-3.4.2-py3.9-nspkg.pth:

Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 169, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\importlib\util.py", line 2, in <module>
    from . import abc
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\importlib\abc.py", line 17, in <module>
    from typing import Protocol, runtime_checkable
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\typing.py", line 26, in <module>
    import re as stdlib_re  # Avoid confusion with the re we export.
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 589, in <module>
    main()
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 576, in main
    known_paths = addsitepackages(known_paths)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 359, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 208, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 179, in addpackage
    import traceback
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Error processing line 1 of c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\matplotlib-3.4.2-py3.9-nspkg.pth:

Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 169, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\importlib\util.py", line 2, in <module>
    from . import abc
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\importlib\abc.py", line 17, in <module>
    from typing import Protocol, runtime_checkable
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\typing.py", line 26, in <module>
    import re as stdlib_re  # Avoid confusion with the re we export.
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 589, in <module>
    main()
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 576, in main
    known_paths = addsitepackages(known_paths)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 359, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 208, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site.py", line 179, in addpackage
    import traceback
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
26547 ERROR: An error occurred while packaging
Traceback (most recent call last):
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\auto_py_to_exe\packaging.py", line 131, in package
    run_pyinstaller()
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\__main__.py", line 126, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\users\mehme\appdata\local\programs\python\python39\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 "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 762, in build
    exec(code, spec_namespace)
  File "C:\Users\mehme\AppData\Local\Temp\tmpug4gvv84\MAIN.spec", line 7, in <module>
    a = Analysis(['C:/Users/mehme/Desktop/Github/SpotifyLyrics/MAIN.py'],
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 294, in __init__
    self.__postinit__()
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\datastruct.py", line 159, in __postinit__
    self.assemble()
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 467, in assemble
    priority_scripts.append(self.graph.add_script(script))
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\depend\analysis.py", line 304, in add_script
    self._top_script_node = super(PyiModuleGraph, self).add_script(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1433, in add_script
    self._process_imports(n)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
    target_module = self._safe_import_hook(*import_info, **kwargs)[0]
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
    target_modules = self.import_hook(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1505, in import_hook
    target_package, target_module_partname = self._find_head_package(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package
    target_package = self._safe_import_module(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\depend\analysis.py", line 447, in _safe_import_module
    return super(PyiModuleGraph, self)._safe_import_module(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
    self._process_imports(n)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
    target_module = self._safe_import_hook(*import_info, **kwargs)[0]
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
    target_modules = self.import_hook(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1505, in import_hook
    target_package, target_module_partname = self._find_head_package(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package
    target_package = self._safe_import_module(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\depend\analysis.py", line 447, in _safe_import_module
    return super(PyiModuleGraph, self)._safe_import_module(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
    self._process_imports(n)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
    target_module = self._safe_import_hook(*import_info, **kwargs)[0]
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
    target_modules = self.import_hook(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1505, in import_hook
    target_package, target_module_partname = self._find_head_package(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package
    target_package = self._safe_import_module(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\depend\analysis.py", line 447, in _safe_import_module
    return super(PyiModuleGraph, self)._safe_import_module(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
    self._process_imports(n)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
    target_module = self._safe_import_hook(*import_info, **kwargs)[0]
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2510, in _safe_import_hook
    self.import_hook(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1544, in import_hook
    for target_submodule in self._import_importable_package_submodules(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1794, in _import_importable_package_submodules
    submodule = self._safe_import_module(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\depend\analysis.py", line 447, in _safe_import_module
    return super(PyiModuleGraph, self)._safe_import_module(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
    self._process_imports(n)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
    target_module = self._safe_import_hook(*import_info, **kwargs)[0]
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
    target_modules = self.import_hook(
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
    submodule = self._safe_import_module(head, mname, submodule)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\depend\analysis.py", line 437, in _safe_import_module
    hook_module.pre_safe_import_module(hook_api)
  File "c:\users\mehme\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\hooks\pre_safe_import_module\hook-urllib3.packages.six.moves.py", line 33, in pre_safe_import_module
    raise SystemExit("pre-safe-import-module hook failed, needs fixing.")
SystemExit: pre-safe-import-module hook failed, needs fixing.
pip uninstall -y enum34

对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 auto-py-to-exe 无法将.py 转换为 exe - Trouble Converting .py to ,exe with auto-py-to-exe ModuleNotFoundError:使用 auto-py-to-exe 将 Python 文件转换为可执行文件时没有名为“pandas”的模块 - ModuleNotFoundError: No module named 'pandas' when converting Python file to Executable using auto-py-to-exe 自动 Py-to-Exe | 签署 Windows EXE 文件 - Auto-Py-to-Exe | Signing a Windows EXE file auto-py-to-exe 生成 2 条错误消息:“UPX 不可用”和“打包时出错” - auto-py-to-exe generated 2 error messages: `UPX is not available` and `an error occurred while packaging` 在 auto-py-to-exe 之后 Python 程序运行方式不同 - Python program runs differently after auto-py-to-exe 安装auto-py-to-exe时出错如何解决? - How to solve error when installing auto-py-to-exe? 安装 pip package auto-py-to-exe 时出错 - Error in installing pip package auto-py-to-exe 致命错误:无法执行“脚本名称”| 自动 py 到 exe - Fatal Error: Failed to execute "script name" | auto-py-to-exe 在Windows上安装Python 3.7的auto-py-to-exe模块会在Windows上返回错误 - Installing auto-py-to-exe module for Python 3.7 returns an error on Windows 无法安装或使用 auto-py-to-exe - Unable to install and or use auto-py-to-exe
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM