简体   繁体   中英

Pycharm cannot connect to console

The following error is returned when I clicked the Python console tab in pycharm (bottom left):

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.

I am not able to run the program:

在此处输入图像描述

and I am always stuck at connecting the console:

在此处输入图像描述

I never had this problem before not until I recently reset my computer. PATH was added too, to user environmental variables. How can I fix this?

It seems like a path issue that's arising as a result of the path variables not being found by pyCharm.

You can try the solutions proposed in another question since it seems very similar to your problem (in brief: you need to set manually add the PATH variables in PyCharm to the console)

You can also simplyedit python's site.py(in Lib dir) directly and set the path, though I would not highly recommend this :

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'),
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM