簡體   English   中英

pycharm 無法使用 python3.8 連接到控制台

[英]pycharm does not connect to console with python3.8

我不知道為什么; 但是自從python 3.8發布之后; 我無法運行 pycharm 控制台,它始終處於“正在連接”狀態。

我對 python 3.7 沒有問題; 因為控制台會立即打開。

在這里你可以看到我已經多次嘗試運行控制台,但我知道,即使我等了一天; 它不連接到控制台; 但是當我將解釋器從 python3.8 更改為 python3.7 時,我打開的新控制台都在一秒鍾內設置好了。

錯誤:

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 專業版 2019.1.3

它在PyCharm (Community) 2019.3上運行良好。

PyCharm提供[PyPI]: thriftpy (對於當前版本,它是一個經過修改的v0.3.8 ),因為它需要它用於不同的功能(包括Python 控制台)。

Python的3.8想出了一組修改(一個例子是[巨蟒]:PEP 570 - Python的陣地,只有參數)要求,以工作在許多現有的(第3方)封裝的改變對它們(一些他們,還有在制品)。

顯然, ThriftPy是需要更改的軟件包之一。 然而,它自 2016 年以來就沒有得到維護,因此JetBrains將(副本/分叉?)保存在他們的存儲庫中。

無論如何,您面臨的問題已由[GitHub] 解決:JetBrains/intellij-community - PY-36069 Python 控制台支持 Python 3.8
不幸的是,我在JetBrains.YouTrack上找不到這個問題,所以我沒有關於它的任何其他信息(比如它何時被修復等等)。

我可以告訴你的(也在開頭提到),它在PyCharm (Community) 2019.3 中已經修復(有效) ,所以如果你升級它,你應該不再有這個問題。

解決方法(如果升級不是一種選擇)是將補丁(在提交URL 中)應用到您的(本地) _compat.py文件。 檢查[SO]:從 PyCharm 社區版中的鼠標右鍵單擊上下文菜單運行/調試 Django 應用程序的單元測試? (@CristiFati 的回答)Patching utrunner部分)了解如何應用補丁(在Win 上)。
小提一下:將反向補丁應用到我的本地文件,使問題可見。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM