Pycharm运行Python代码报错解决方法(图解), ImportError: DLL load failed: 找不到指定的模块

报错如下

C:\ProgramData\Anaconda3\python.exe "C:\Program Files\JetBrains\PyCharm 2018.3.3\helpers\pydev\pydevconsole.py" --mode=client --port=52241
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2018.3.3\helpers\pydev\pydevconsole.py", line 5, in <module>
    from _pydev_comm.rpc import make_rpc_client, start_rpc_server, start_rpc_server_and_make_client
  File "C:\Program Files\JetBrains\PyCharm 2018.3.3\helpers\pydev\_pydev_comm\rpc.py", line 4, in <module>
    from _pydev_comm.server import TSingleThreadedServer
  File "C:\Program Files\JetBrains\PyCharm 2018.3.3\helpers\pydev\_pydev_comm\server.py", line 4, in <module>
    from _shaded_thriftpy.server import TServer
  File "C:\Program Files\JetBrains\PyCharm 2018.3.3\helpers\third_party\thriftpy\_shaded_thriftpy\server.py", line 9, in <module>
    from _shaded_thriftpy.transport import (
  File "C:\Program Files\JetBrains\PyCharm 2018.3.3\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 2018.3.3\helpers\third_party\thriftpy\_shaded_thriftpy\transport\sslsocket.py", line 7, in <module>
    import ssl
  File "C:\ProgramData\Anaconda3\lib\ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: DLL load failed: 找不到指定的模块。
Process finished with exit code 1

pycharm窗口显示
Pycharm运行Python代码报错解决方法(图解), ImportError: DLL load failed: 找不到指定的模块_第1张图片

解决方法

1.点击【开始】>> 找到 Anaconda3(64-bit)文件夹 >> 点击【Anaconda Prompt】
Pycharm运行Python代码报错解决方法(图解), ImportError: DLL load failed: 找不到指定的模块_第2张图片
2.出现命令行界面 >> 输入echo %PATH%,点击【回车】 >> Ctrl+A(全选) >> Ctrl +C(复制)
Pycharm运行Python代码报错解决方法(图解), ImportError: DLL load failed: 找不到指定的模块_第3张图片
3.Ctrl+V(粘贴)>> 选取输出(output)的部分复制
Pycharm运行Python代码报错解决方法(图解), ImportError: DLL load failed: 找不到指定的模块_第4张图片
4.Pycharm界面 >> 【File】>> 【Settings…】
Pycharm运行Python代码报错解决方法(图解), ImportError: DLL load failed: 找不到指定的模块_第5张图片
5.【Build, Execution, Deployment】>> 【Console】>> 【Python Console】
Pycharm运行Python代码报错解决方法(图解), ImportError: DLL load failed: 找不到指定的模块_第6张图片
6.添加【Environment variables】>> 点击【OK】,如图所示(Name 填 PATH,Value 填 命令行输出的部分)
Pycharm运行Python代码报错解决方法(图解), ImportError: DLL load failed: 找不到指定的模块_第7张图片
7.点击【Apply】>> 点击【OK】
Pycharm运行Python代码报错解决方法(图解), ImportError: DLL load failed: 找不到指定的模块_第8张图片
8.再运行一次,不报错,错误已经解决
Pycharm运行Python代码报错解决方法(图解), ImportError: DLL load failed: 找不到指定的模块_第9张图片

原文链接:https://stackoverflow.com/questions/54175042/python-3-7-anaconda-environment-import-ssl-dll-load-fail-error
Pycharm运行Python代码报错解决方法(图解), ImportError: DLL load failed: 找不到指定的模块_第10张图片
【Activate your Conda environment】这一步激活环境我没看明白,直接跳过了(好像不影响),如果有知道,帮忙讲解,感激不尽,emmmmm

你可能感兴趣的:(Pycharm运行Python代码报错解决方法(图解), ImportError: DLL load failed: 找不到指定的模块)