Pycharm无法连接到控制台

2024-10-16 20:40:25 发布

您现在位置:Python中文网/ 问答频道 /正文

单击pycharm(左下角)中的Python控制台选项卡时返回以下错误:

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition with Anaconda plugin 2020.1\plugins\python-ce\helpers\pydev\pydevconsole.py", line 5, in <module>
    from _pydev_comm.pydev_rpc import make_rpc_client, start_rpc_server, start_rpc_server_and_make_client
  File "C:\Program Files\JetBrains\PyCharm Community Edition with Anaconda plugin 2020.1\plugins\python-ce\helpers\pydev\_pydev_comm\pydev_rpc.py", line 4, in <module>
    from _pydev_comm.pydev_server import TSingleThreadedServer
  File "C:\Program Files\JetBrains\PyCharm Community Edition with Anaconda plugin 2020.1\plugins\python-ce\helpers\pydev\_pydev_comm\pydev_server.py", line 4, in <module>
    from _shaded_thriftpy.server import TServer
  File "C:\Program Files\JetBrains\PyCharm Community Edition with Anaconda plugin 2020.1\plugins\python-ce\helpers\third_party\thriftpy\_shaded_thriftpy\server.py", line 9, in <module>
    from _shaded_thriftpy.transport import (
  File "C:\Program Files\JetBrains\PyCharm Community Edition with Anaconda plugin 2020.1\plugins\python-ce\helpers\third_party\thriftpy\_shaded_thriftpy\transport\__init__.py", line 57, in <module>
    from .sslsocket import TSSLSocket, TSSLServerSocket  # noqa
  File "C:\Program Files\JetBrains\PyCharm Community Edition with Anaconda plugin 2020.1\plugins\python-ce\helpers\third_party\thriftpy\_shaded_thriftpy\transport\sslsocket.py", line 7, in <module>
    import ssl
  File "C:\Users\jkong\anaconda3\lib\ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: DLL load failed: The specified module could not be found.

我无法运行该程序:

enter image description here

我总是无法连接控制台:

enter image description here

我以前从未遇到过这个问题,直到最近我重置了电脑。路径也被添加到用户环境变量中。我怎样才能解决这个问题


Tags: inpycommunityimportwithlinefilesprogram
1条回答
网友
1楼 · 发布于 2024-10-16 20:40:25

这似乎是由于pyCharm未找到路径变量而导致的路径问题

您可以尝试建议的解决方案in another question 因为它似乎与您的问题非常相似(简而言之:您需要设置 手动将PyCharm中的PATH变量添加到控制台)

您也可以直接简单地编辑python的site.py(在Lib dir中)并设置路径,尽管我不强烈建议这样做:

from os.path import join, abspath, dirname
base_path = dirname(dirname(abspath(__file__)))
os.environ['PATH'] = '%s%s' % (
    os.environ['PATH'],
    join(base_path, 'Library', 'bin'),
)

相关问题 更多 >