pycharm无法使用python3.8连接到控制台 [英] pycharm does not connect to console with python3.8

查看:1552
本文介绍了pycharm无法使用python3.8连接到控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么;但由于python 3.8已发布;我无法运行pycharm控制台,它始终处于正在连接状态。

I dont know why; but since python 3.8 has been released; I cant run pycharm console and it is always in the "being connected" status.

我对python 3.7没问题;因为立即打开了控制台。

在这里您可以看到我已经尝试过几次运行控制台了,但是我知道,即使我等了一天;它不连接到控制台。但是当我将解释器从python3.8更改为python3.7时,我打开的新控制台都在一秒钟之内就完成了设置。

Here you can see that I have tried several times to run the console but I know, even if I wait a day; It does not connect to console; but when I change the interpreter from python3.8 to python3.7, The new consoles I open are all set up within a second.

错误:

C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydevd_bundle\pydevd_resolver.py:138: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if found.get(name) is not 1:
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\pydevconsole.py", line 33, in <module>
    from _pydev_bundle.pydev_console_utils import BaseInterpreterInterface
  File "C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_bundle\pydev_console_utils.py", line 11, in <module>
    from _pydevd_bundle import pydevd_thrift
  File "C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydevd_bundle\pydevd_thrift.py", line 17, in <module>
    from pydev_console.protocol import DebugValue, GetArrayResponse, ArrayData, ArrayHeaders, ColHeader, RowHeader, \
  File "C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\pydev_console\protocol.py", line 6, in <module>
    _console_thrift = _shaded_thriftpy.load(os.path.join(os.path.dirname(os.path.realpath(__file__)), "console.thrift"),
  File "C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\third_party\thriftpy\_shaded_thriftpy\parser\__init__.py", line 29, in load
    thrift = parse(path, module_name, include_dirs=include_dirs,
  File "C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\third_party\thriftpy\_shaded_thriftpy\parser\parser.py", line 502, in parse
    parser.parse(data)
  File "C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\third_party\thriftpy\_shaded_ply\yacc.py", line 331, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
  File "C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\third_party\thriftpy\_shaded_ply\yacc.py", line 1106, in parseopt_notrack
    p.callable(pslice)
  File "C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\third_party\thriftpy\_shaded_thriftpy\parser\parser.py", line 212, in p_struct
    val = _fill_in_struct(p[1], p[3])
  File "C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\third_party\thriftpy\_shaded_thriftpy\parser\parser.py", line 765, in _fill_in_struct
    gen_init(cls, thrift_spec, default_spec)
  File "C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\third_party\thriftpy\_shaded_thriftpy\thrift.py", line 103, in gen_init
    cls.__init__ = init_func_generator(default_spec)
  File "C:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\third_party\thriftpy\_shaded_thriftpy\_compat.py", line 102, in init_func_generator
    new_code = types.CodeType(len(varnames),
TypeError: an integer is required (got type bytes)

照片:

pycharm规格:pycharm professional vers ion 2019.1.3

推荐答案

PyCharm(社区) 2019.3上运行良好

It works fine on PyCharm (Community) 2019.3.

PyCharm 发运 [PyPI]:节俭(对于当前版本,它是修改的 v0.3.8 ),因为它需要用于不同的功能(包括 Python控制台)。

PyCharm ships [PyPI]: thriftpy (for current version, it's a modified v0.3.8), as it needs it for different features (including the Python Console).

Python 3.8 进行了一系列更改(一个示例是 [Python]:PEP 570-仅Python位置参数)需要对许多现有的( 3 rd -party)程序包以使其起作用(对于其中某些程序,仍然有 WiP )。

Python 3.8 came with a set of changes (one example is [Python]: PEP 570 -- Python Positional-Only Parameters) requiring changes in many of the existing (3rd-party) packages in order for them to work (for some of them, there's still WiP).

显然, ThriftPy 是需要更改的软件包之一。但是自2016年以来一直未进行维护,因此 JetBrains 将(副本/ fork?)保留在其存储库中。

Apparently, ThriftPy is one of those packages that require changes. However it hasn't been maintained since 2016, so JetBrains keeps (a copy / fork ?) in their repository.

无论如何,问题出在您正面临的问题,已由 [GitHub]:JetBrains / intellij-community-PY-36069修复Python控制台对Python 3.8的支持
很遗憾,我在 JetBrains.YouTrack 上找不到该问题,所以我没有任何其他问题了有关它的信息(例如修复时间等)。

Anyway, the problem you're facing, was fixed by [GitHub]: JetBrains/intellij-community - PY-36069 Python console support for Python 3.8.
Unfortunately, I couldn't find the issue on JetBrains.YouTrack, so I don't have any additional info about it (like when it was fixed, and so on).

我可以告诉您的是(<开始>也提到过),它是 PyCharm(社区)2019.3中已修复(有效) ,因此,如果您对其进行升级,则应该不再有此问题。

What I can tell you (also mentioned at the beginning), is that it was fixed (works) in PyCharm (Community) 2019.3, so if you upgrade it, you should no longer have this problem.

将采用一种解决方法(如果无法进行升级)修补程序(在提交 URL 中)到您的(本地) _compat.py 文件。检查 [ [SO]:从鼠标右键单击PyCharm Community Edition中的上下文菜单运行/调试Django应用程序的UnitTests? (@CristiFati的答案)修补 utrunner 部分),了解如何应用补丁(在 Win 上)。
小提:将反向补丁应用到我的本地文件中,使问题显而易见。

A workaround (if upgrading is not an option) would be to apply the patch (in the commit URL) to your (local) _compat.py file. Check [SO]: Run / Debug a Django application's UnitTests from the mouse right click context menu in PyCharm Community Edition? (@CristiFati's answer) (Patching utrunner section) for how to apply patches (on Win).
Small mention: applying the reversed patch to my local file, made the problem visible.

这篇关于pycharm无法使用python3.8连接到控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆