最近重装了系统,决心使用Anaconda来管理python包和虚拟环境。在完成一系列配置后,运行程序,发现老是报错
D:Anaconda3envsjobnote>python E:workspaceJobNoteApi un.py Traceback (most recent call last): File "E:workspaceJobNoteApi un.py", line 2, in <module> from app import create_app File "E:workspaceJobNoteApiapp\__init__.py", line 3, in <module> from flask import Flask, request File "D:Anaconda3envsjobnotelibsite-packagesflask\__init__.py", line 21, in <module> from .app import Flask, Request, Response File "D:Anaconda3envsjobnotelibsite-packagesflaskapp.py", line 25, in <module> from . import cli, json File "D:Anaconda3envsjobnotelibsite-packagesflaskcli.py", line 18, in <module> import ssl File "D:Anaconda3envsjobnotelibssl.py", line 98, in <module> import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed: 找不到指定的模块。
网上找了好多方法都解决不了,昨天突然自己好了,也没找到问题所在。
今天早晨来,又不行了,还是报错。突然想起来是不是环境变量造成的,echo %path%打印出环境变量来,吓人一跳
D:Anaconda3envsjobnote>echo %path%
D:Program FilesVanDyke SoftwareClients;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:WindowsSystem32OpenSSH;C:Program FilesJavajdk1.8.0_144in;C:Program FilesJavajdk1.8.0_144jrein;%conda_home%;%conda_home%Scripts;%conda_home%Libraryin;d:Program FilesGitcmd;C:UsersqpandAppDataLocalMicrosoftWindowsApps;
之前做的conda_home变量根本没有被解析出来,重新设置了一下,看到变量已经恢复。重新运行程序,恢复正常。
具体环境变量为什么没有解析出来,还有待研究