【问题标题】:PyInstaller does not make the exe after updating to Python 10 [duplicate]更新到 Python 10 后 PyInstaller 不生成 exe [重复]
【发布时间】:2021-11-30 09:36:23
【问题描述】:
> C:\Users\Studio\Desktop\New folder>python -m PyInstaller PSEClient.py
> --icon=primeparts.ico --noconsole -F 78 INFO: PyInstaller: 4.7 78 INFO: Python: 3.10.0 93 INFO: Platform: Windows-10-10.0.19043-SP0 93
> INFO: wrote C:\Users\Studio\Desktop\New folder\PSEClient.spec 93 INFO:
> UPX is not available. 93 INFO: Extending PYTHONPATH with paths
> ['C:\\Users\\Studio\\Desktop\\New folder'] 328 INFO: checking Analysis
> 328 INFO: Building Analysis because Analysis-00.toc is non existent
> 328 INFO: Initializing module dependency graph... 328 INFO: Caching
> module graph hooks... 343 INFO: Analyzing base_library.zip ... 3171
> INFO: Processing pre-find module path hook distutils from
> 'C:\\Users\\Studio\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
> 3171 INFO: distutils: retargeting to non-venv dir
> 'C:\\Users\\Studio\\AppData\\Local\\Programs\\Python\\Python310\\lib'
> 4218 INFO: Caching module dependency graph... 4359 INFO: running
> Analysis Analysis-00.toc 4375 INFO: Adding
> Microsoft.Windows.Common-Controls to dependent assemblies of final
> executable   required by
> C:\Users\Studio\AppData\Local\Programs\Python\Python310\python.exe
> 4421 INFO: Analyzing C:\Users\Studio\Desktop\New folder\PSEClient.py
> 5734 INFO: Processing pre-find module path hook site from
> 'C:\\Users\\Studio\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
> 5734 INFO: site: retargeting to fake-dir
> 'C:\\Users\\Studio\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\fake-modules'
> Traceback (most recent call last):   File
> "C:\Users\Studio\AppData\Local\Programs\Python\Python310\lib\runpy.py",
> line 196, in _run_module_as_main
>     return _run_code(code, main_globals, None,   File "C:\Users\Studio\AppData\Local\Programs\Python\Python310\lib\runpy.py",
> line 86, in _run_code
>     exec(code, run_globals)   File "C:\Users\Studio\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py",
> line 134, in <module>
>     run()   File "C:\Users\Studio\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py",
> line 124, in run
>     run_build(pyi_config, spec_file, **vars(args))   File "C:\Users\Studio\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py",
> line 58, in run_build
>     argval = const_list[const_index] IndexError: tuple index out of range

输出已被裁剪。

我不知道发生了什么。 更新 Python 后,每次我尝试都会发生这种情况 使这个特定的脚本成为可执行文件。 该脚本运行完美,没有任何问题,但 PyInstaller 输出

IndexError: 元组索引超出范围

Auto-py-to-exe 也是如此。

在更新之前,我可以毫无问题地制作 exe。

有什么想法吗? 提前致谢

【问题讨论】:

标签: python pyinstaller upgrade executable script


【解决方案1】:

这是在 Python 3.10 上运行的 known issue with pyinstallerpyinstaller 的主要发布渠道似乎没有修复,但可以在本地环境中应用 a hotfix 以重新启用 pyinstaller 的预期功能,直到可以分发适当的补丁:

  1. 打开 Python 基础文件 C:\Python310\lib\dis.py(对于其他安装位置,请将 C:\Python310 替换为您安装 Python 3.10 的目录。)

  2. 在文件中找到def _unpack_opargs

  3. else 块中添加extended_arg = 0 行,使其看起来类似于以下内容:

     else:
         arg = None
         extended_arg = 0 
     yield (i, op, arg)
    
  4. 保存dis.py,然后重试您的操作。

【讨论】:

  • 是的!非常感谢你是我的英雄!
猜你喜欢
  • 2023-04-08
  • 1970-01-01
  • 2019-10-28
  • 1970-01-01
  • 2020-12-17
  • 1970-01-01
  • 2021-01-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多