安装 keras 后启动时,anaconda 提示始终以这些命令集开头
Posted
技术标签:
【中文标题】安装 keras 后启动时,anaconda 提示始终以这些命令集开头【英文标题】:anaconda prompt always start with these set of commands upon launch after installing keras 【发布时间】:2019-07-03 12:40:45 【问题描述】:我在 Windows 10 上使用 anaconda 2018.2。在“Anaconda Prompt”上使用 conda 安装 keras 后,我遇到了一个奇怪的问题。每当启动“Anaconda Prompt”时,它都会自动执行一组命令。每当运行任何 conda 命令时,它也会运行相同的命令集。
如何从“Anaconda Prompt”中删除这组烦人的命令?谢谢。
命令如下图所示;
C:\WINDOWS\system32>python C:\ProgramData\Anaconda3_2018_2\etc\keras\load_config.py 1>temp.txt
C:\WINDOWS\system32>set /p KERAS_BACKEND= 0<temp.txt
C:\WINDOWS\system32>del temp.txt
C:\WINDOWS\system32>python -c "import keras" 1>nul 2>&1
C:\WINDOWS\system32>if errorlevel 1 (
ver 1>nul
set "KERAS_BACKEND=theano"
python -c "import keras" 1>nul 2>&1
)
C:\WINDOWS\system32>SET DISTUTILS_USE_SDK=1
C:\WINDOWS\system32>SET MSSdk=1
C:\WINDOWS\system32>SET platform=
C:\WINDOWS\system32>IF /I [AMD64] == [amd64] set "platform=true"
C:\WINDOWS\system32>IF /I [] == [amd64] set "platform=true"
C:\WINDOWS\system32>if defined platform (set "VSREGKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0" ) ELSE (set "VSREGKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0" )
C:\WINDOWS\system32>for /F "skip=2 tokens=2,*" %A in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0" /v InstallDir') do SET "VSINSTALLDIR=%B"
ERROR: The system was unable to find the specified registry key or value.
C:\WINDOWS\system32>if "" == "" (set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\" )
C:\WINDOWS\system32>if "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\" == "" (
ECHO "Did not find VS in registry or in VS140COMNTOOLS env var - exiting"
exit 1
)
C:\WINDOWS\system32>echo "Found VS2014 at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\"
"Found VS2014 at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\"
C:\WINDOWS\system32>SET "VS_VERSION=14.0"
C:\WINDOWS\system32>SET "VS_MAJOR=14"
C:\WINDOWS\system32>SET "VS_YEAR=2015"
C:\WINDOWS\system32>set "MSYS2_ARG_CONV_EXCL=/AI;/AL;/OUT;/out"
C:\WINDOWS\system32>set "MSYS2_ENV_CONV_EXCL=CL"
C:\WINDOWS\system32>set "PY_VCRUNTIME_REDIST=\vcruntime140.dll"
C:\WINDOWS\system32>set "CFLAGS= -MD -GL"
C:\WINDOWS\system32>set "CXXFLAGS= -MD -GL"
C:\WINDOWS\system32>set "LDFLAGS_SHARED= -LTCG ucrt.lib"
C:\WINDOWS\system32>IF /I [] == [win-64] (set "folder=x64" ) else (set "folder=x86" )
C:\WINDOWS\system32>for /F "tokens=*" %I in ('dir "C:\Program Files (x86)\Windows Kits\*1*" /B /O:N') do for %A in (%~I) do if "%A" == "8.1" set win=%A
C:\WINDOWS\system32>for %A in (10) do if "%A" == "8.1" set win=%A
C:\WINDOWS\system32>if "10" == "8.1" set win=10
C:\WINDOWS\system32>for %A in (8.1) do if "%A" == "8.1" set win=%A
C:\WINDOWS\system32>if "8.1" == "8.1" set win=8.1
C:\WINDOWS\system32>for /F "tokens=*" %I in ('dir "C:\Program Files (x86)\Windows Kits\*1*" /B /O:N') do for %A in (%~I) do if "%A" == "10" set win=%A
C:\WINDOWS\system32>for %A in (10) do if "%A" == "10" set win=%A
C:\WINDOWS\system32>if "10" == "10" set win=10
C:\WINDOWS\system32>for %A in (8.1) do if "%A" == "10" set win=%A
C:\WINDOWS\system32>if "8.1" == "10" set win=8.1
C:\WINDOWS\system32>setlocal enabledelayedexpansion
C:\WINDOWS\system32>if "10" == "10" (
for /F "tokens=*" %I in ('dir "C:\Program Files (x86)\Windows Kits\10\bin\10*" /B /O:N') do for %A in (%~I) do set last=%A
set "sdk_bin_path=C:\Program Files (x86)\Windows Kits\10\bin\!last!\x86"
) else (set "sdk_bin_path=C:\Program Files (x86)\Windows Kits\8.1\bin\x86" )
C:\WINDOWS\system32>for %A in (10.0.14393.0) do set last=%A
C:\WINDOWS\system32>set last=10.0.14393.0
C:\WINDOWS\system32>for %A in (10.0.15063.0) do set last=%A
C:\WINDOWS\system32>set last=10.0.15063.0
C:\WINDOWS\system32>for %A in (10.0.16299.0) do set last=%A
C:\WINDOWS\system32>set last=10.0.16299.0
C:\WINDOWS\system32>for %A in (10.0.17134.0) do set last=%A
C:\WINDOWS\system32>set last=10.0.17134.0
C:\WINDOWS\system32>for %A in (10.0.17763.0) do set last=%A
C:\WINDOWS\system32>set last=10.0.17763.0
C:\WINDOWS\system32>endlocal & set "PATH=C:\ProgramData\Anaconda3_2018_2;C:\ProgramData\Anaconda3_2018_2\Library\mingw-w64\bin;C:\ProgramData\Anaconda3_2018_2\Library\usr\bin;C:\ProgramData\Anaconda3_2018_2\Library\bin;C:\ProgramData\Anaconda3_2018_2\Scripts;C:\ProgramData\Anaconda3_2018_2\bin;C:\ProgramData\Anaconda3_2018_2\condabin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\libnvvp;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Microsoft MPI\Bin\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\PDFtk\bin\;C:\Program Files (x86)\Microchip\xc8\v1.37\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Nordic Semiconductor\nrf5x\bin\;C:\Program Files (x86)\Microchip\xc8\v1.35\bin;C:\ProgramData\ComposerSetup\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Oracle\VirtualBox;C:\Program Files\R\R-3.3.2\bin\x64;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\WINDOWS\System32\OpenSSH\;C:\cudnn-9.0-windows10-x64-v7.2.1.38\cuda\bin;C:\Program Files (x86)\Graphviz2.38\bin;C:\Program Files\Git\cmd;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Scripts;C:\Program Files\nodejs\;C:\Users\young\.windows-build-tools\python27\;C:\Users\young\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\young\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\.bin;C:\Users\young\AppData\Roaming\npm\node_modules\.bin;C:\Users\young\Dropbox\PortableApps\PortableApps\ConsolePortable\Data\scripts;C:\Users\young\.windows-build-tools\python27\;C:\Users\young\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\young\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\.bin;C:\Users\young\AppData\Roaming\npm\node_modules\.bin;C:\Users\young\Dropbox\PortableApps\PortableApps\ConsolePortable\Data\scripts;C:\Program Files\Microsoft VS Code\bin;C:\Users\young\AppData\Roaming\Composer\vendor\bin;C:\Users\young\AppData\Local\Microsoft\WindowsApps;C:\Users\young\AppData\Local\GitHubDesktop\bin;C:\Users\young\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\young\AppData\Roaming\npm;C:\ProgramData\Anaconda3_2018_2\lib\site-packages\pywin32_system32;C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86"
C:\WINDOWS\system32>SET "CMAKE_GENERATOR=Visual Studio 14 2015 Win64"
C:\WINDOWS\system32>CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\..\..\VC\vcvarsall.bat" amd64
【问题讨论】:
你应该向 anaconda 人报告这些问题 Anaconda 对keras
有很多问题。请看这个Question。这可能会有所帮助。
【参考方案1】:
假设你使用的是windows:
Keras 使用 tensorflow,而它又依赖于 VC++ 构建工具。请按照以下步骤操作
-
打开 Microsoft Visual Studio 链接:https://visualstudio.microsoft.com/downloads/
选择“社区版本 2019”
下载安装程序并在列表中选择VC++ Build tools
还建议为您的项目创建一个虚拟环境,因此使用命令创建一个虚拟环境(最好在您的项目文件夹内)
py -m pip install --user .venv
【讨论】:
以上是关于安装 keras 后启动时,anaconda 提示始终以这些命令集开头的主要内容,如果未能解决你的问题,请参考以下文章
windows10安装Anaconda+TensorFlow(CPU)+keras+Pycharm
Anaconda下安装 TensorFlow 和 keras