m0_64060054 2023-12-18 15:07 采纳率: 50%
浏览 2

pyinstaller运行出错

#pyinstaller运行后提示报错,无法解决
#Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Python311\Scripts\pyinstaller.exe_main
.py", line 7, in
File "C:\Python311\Lib\site-packages\PyInstaller_main
.py", line 214, in console_script_run
run()
^^^^^
File "C:\Python311\Lib\site-packages\PyInstaller_main
.py", line 170, in run
parser = generate_parser()
^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\PyInstaller_main_.py", line 136, in generate_parser
import PyInstaller.building.build_main
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\PyInstaller\building\build_main.py", line 28, in
from PyInstaller.building.api import COLLECT, EXE, MERGE, PYZ
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\PyInstaller\building\api.py", line 32, in
from PyInstaller.building.splash import Splash # argument type validation in EXE
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\PyInstaller\building\splash.py", line 23, in
from PyInstaller.depend import bindepend
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\PyInstaller\depend\bindepend.py", line 25, in
from PyInstaller.depend import dylib, utils
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\PyInstaller\depend\utils.py", line 28, in
from PyInstaller.depend import bytecode
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\PyInstaller\depend\bytecode.py", line 120, in
_cache_instruction_filter = bytecode_regex(rb"(CACHE.)|(..)")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\PyInstaller\depend\bytecode.py", line 53, in bytecode_regex
pattern = re.sub(
^^^^^^^
return _compile(pattern, flags).sub(repl, string, count)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\PyInstaller\depend\bytecode.py", line 55, in
lambda m: _instruction_to_regex(m[1].decode()),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\PyInstaller\depend\bytecode.py", line 36, in _instruction_to_regex
return re.escape(bytes([opmap[x]]))
~~~~~^^^
KeyError: 'CACHE'

  • 写回答

1条回答 默认 最新

  • 小孟多 2023-12-18 15:20
    关注

    根据你提供的错误信息,问题可能是由于PyInstaller与Python版本不兼容导致的。目前的错误提示显示在bytecode.py文件中出现了KeyError: 'CACHE'的异常。

    解决这个问题的方法是降低Python的版本,因为某些PyInstaller版本可能不支持最新的Python版本。你可以尝试将Python版本降低到3.7或更低,然后重新安装PyInstaller并再次尝试运行。

    另外,建议你使用pip工具来安装PyInstaller,确保使用的是最新版本。可以使用以下命令来安装最新版的PyInstaller:

    pip install --upgrade pyinstaller
    如果问题仍然存在,你可以尝试使用其他打包工具,例如cx_Freeze或py2exe等,以看是否能解决该问题。

    评论

报告相同问题?

问题事件

  • 创建了问题 12月18日

悬赏问题

  • ¥15 陆空双模式无人机飞控设置
  • ¥15 sentaurus lithography
  • ¥100 求抖音ck号 或者提ck教程
  • ¥15 关于#linux#的问题:子进程1等待子进程A、B退出后退出(语言-c语言)
  • ¥20 web页面如何打开Outlook 365的全球离线通讯簿功能
  • ¥15 io.jsonwebtoken.security.Keys
  • ¥15 急,ubuntu安装后no caching mode page found等
  • ¥15 联想交换机NE2580O/NE1064TO安装SONIC
  • ¥15 防火墙的混合模式配置
  • ¥15 Ubuntu不小心注销了要怎么恢复啊