问题
这个问题主要是在Python3.7以上的版本中遇到,用pyinstaller打包的时候发现报错
(pyinstallerEnv) D:\virtualEnv\pyinstallerEnv\Scripts>auto-py-to-exe
pygame 2.5.2 (SDL 2.28.3, Python 3.10.0)
Hello from the pygame community. https://www.pygame.org/contribute.html
12210 ERROR: An error occurred while packaging
Traceback (most recent call last):
File "D:\1\Python310\lib\site-packages\auto_py_to_exe\packaging.py", line 132, in package
run_pyinstaller()
File "D:\1\Python310\lib\site-packages\PyInstaller\__main__.py", line 198, in run
run_build(pyi_config, spec_file, **vars(args))
File "D:\1\Python310\lib\site-packages\PyInstaller\__main__.py", line 69, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "D:\1\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 1069, in main
build(specfile, distpath, workpath, clean_build)
File "D:\1\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 1009, in build
exec(code, spec_namespace)
File "C:\Users\admin\AppData\Local\Temp\tmp4_2ywen0\enjoytraderSpider隧道请求代理版本-多进程.spec", line 4, in <module>
a = Analysis(
File "D:\1\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 470, in __init__
self.__postinit__()
File "D:\1\Python310\lib\site-packages\PyInstaller\building\datastruct.py", line 184, in __postinit__
self.assemble()
File "D:\1\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 608, in assemble
priority_scripts.append(self.graph.add_script(script))
File "D:\1\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 268, in add_script
self._top_script_node = super().add_script(pathname)
File "D:\1\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1260, in add_script
self._process_imports(n)
File "D:\1\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2703, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "D:\1\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 437, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "D:\1\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2160, in _safe_import_hook
target_modules = self.import_hook(
File "D:\1\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1332, in import_hook
target_package, target_module_partname = self._find_head_package(
File "D:\1\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1511, in _find_head_package
target_package = self._safe_import_module(
File "D:\1\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 484, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "D:\1\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1892, in _safe_import_module
self._process_imports(n)
File "D:\1\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2703, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "D:\1\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 437, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "D:\1\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2160, in _safe_import_hook
target_modules = self.import_hook(
File "D:\1\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1345, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "D:\1\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 484, in _safe_import_module
return super().