pycharm run file in console 一直卡在connecting to console

 

 

 

 pycharm在run file in console时会一直右下角会一直卡在connecting to console, 仔细查阅会发现左边还有文件报错.

找到这个_compat.py并修改

大概在101行,把这些全部注释掉   
if PY3: new_code = types.CodeType(int(len(varnames)), 0, len(varnames), code.co_stacksize, code.co_flags, code.co_code, code.co_consts, code.co_names, varnames, code.co_filename, "__init__", code.co_firstlineno, code.co_lnotab, code.co_freevars, code.co_cellvars)

注释掉之后用这些替换

args = [len(varnames),
          0,
          len(varnames),
          code.co_stacksize,
          code.co_flags,
          code.co_code,
          code.co_consts,
          code.co_names,
          varnames,
          code.co_filename,
          "__init__",
          code.co_firstlineno,
          code.co_lnotab,
          code.co_freevars,
          code.co_cellvars]
    if sys.version_info >= (3,8,0):
        args.insert(2,0)
        new_code = types.CodeType(*args)

替换掉之后重启pycharm,然后run file in console,就不会再报错并卡在connecting to console了;

 

posted @ 2022-08-10 00:33  腹肌猿  阅读(518)  评论(0编辑  收藏  举报