Windows10下Conda环境Keras安装失败、激活报SDK错误
基础环境信息
- 操作系统:Windows 10
- 历史使用背景:此前多次创建并使用Conda虚拟环境开展开发工作,使用Keras从未出现异常;本次在项目目录下创建Conda本地虚拟环境安装数据科学相关包时,无法定位问题根因
本次虚拟环境创建操作步骤
- 打开Anaconda Prompt
- 执行
cd path_to_my_project_folder进入项目所在路径 - 执行
conda create --prefix ./env numpy keras tensorflow jupyter notebook flask创建关联项目路径的本地虚拟环境 - 执行
conda activate path_to_my_project_folder/env激活目标虚拟环境
异常现象说明
- 包安装全程及安装结束后均未弹出任何报错提示
- 只要激活该Conda环境,就会自动输出预设的初始化流程命令日志,日志中多次出现 系统找不到指定的文件、目标路径不存在的提示
- 核对已安装包列表时发现,除Keras外,其余要求安装的包均正常完成安装
激活环境时的完整命令行输出日志
(base) C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>conda activate C:/Users/Neerva/Documents/SU/SEM5/ibm_ice/tomato_leaf_disease_prediction/env C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>python C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction\env\etc\keras\load_config.py 1>temp.txt C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>set /p KERAS_BACKEND= 0<temp.txt C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>del temp.txt C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>python -c "import keras" 1>nul 2>&1 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if errorlevel 1 ( ver 1>nul set "KERAS_BACKEND=theano" python -c "import keras" 1>nul 2>&1 ) C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>SET DISTUTILS_USE_SDK=1 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>SET MSSdk=1 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>SET "VS_VERSION=15.0" C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>SET "VS_MAJOR=15" C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>SET "VS_YEAR=2017" C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>set "MSYS2_ARG_CONV_EXCL=/AI;/AL;/OUT;/out" C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>set "MSYS2_ENV_CONV_EXCL=CL" C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>set "PY_VCRUNTIME_REDIST=\bin\vcruntime140.dll" C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>set "CXX=cl.exe" C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>set "CC=cl.exe" C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>set "VSINSTALLDIR=" C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>for /F "usebackq tokens=*" %i in (`vswhere.exe -nologo -products * -version [15.0,16.0) -property installationPath`) do (set "VSINSTALLDIR=%i\" ) C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if not exist "" (for /F "usebackq tokens=*" %i in (`vswhere.exe -nologo -products * -requires Microsoft.VisualStudio.Component.VC.v141.x86.x64 -property installationPath`) do (set "VSINSTALLDIR=%i\" ) ) C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if not exist "" (set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\"" ) C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if not exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\"" (set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\Community\"" ) C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if not exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\"" (set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\BuildTools\"" ) C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if not exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\"" (set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\"" ) C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>IF NOT "" == "" ( set "INCLUDE=;" set "LIB=;" set "CMAKE_PREFIX_PATH=;" ) C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>call :GetWin10SdkDir C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>call :GetWin10SdkDirHelper HKLM\SOFTWARE\Wow6432Node 1>nul 2>&1 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE\Wow6432Node 1>nul 2>&1 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if errorlevel 1 call :GetWin10SdkDirHelper HKLM\SOFTWARE 1>nul 2>&1 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE 1>nul 2>&1 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if errorlevel 1 exit /B 1 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>exit /B 0 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>for /F %i in ('dir /ON /B "\include\10.*"') DO (SET WindowsSDKVer=%~i ) 系统找不到指定的文件。 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if errorlevel 1 (echo "未检测到Windows 10 SDK,不确认后续流程能否正常运行,将继续尝试..." ) else (echo 检测到的Windows SDK版本为:"" ) 检测到的Windows SDK版本为:"" C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>IF "win-64" == "win-64" ( set "CMAKE_GEN=Visual Studio 15 2017 Win64" set "BITS=64" ) else ( set "CMAKE_GEN=Visual Studio 15 2017" set "BITS=32" ) C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>pushd C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\ 系统找不到指定的路径。 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>CALL "VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.16 系统找不到指定的路径。 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>popd C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>IF "" == "" SET "CMAKE_GENERATOR=Visual Studio 15 2017 Win64" C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>call :GetWin10SdkDirHelper HKLM\SOFTWARE\Wow6432Node 1>nul 2>&1 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE\Wow6432Node 1>nul 2>&1 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if errorlevel 1 call :GetWin10SdkDirHelper HKLM\SOFTWARE 1>nul 2>&1 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE 1>nul 2>&1 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>if errorlevel 1 exit /B 1 C:\Users\Neerva\Documents\SU\SEM5\ibm_ice\tomato_leaf_disease_prediction>exit /B 0
关联参考材料
- 已留存3张对应上述报错的界面截图
- 已检索到与本次问题高度相似的Keras官方社区公开讨论issue,对应官方仓库issue编号为13209
内容的提问来源于stack exchange,提问作者Mohak
相关产品推荐
相关产品推荐

