簡體   English   中英

安裝Visual Studio 2019后如何正確激活anaconda環境

[英]How to activate anaconda environments properly after installing visual studio 2019

安裝 Visual Studio 2019 后,我的 anaconda 出現問題。 當我在 anaconda 中創建新環境時,下班后我嘗試激活環境時遇到問題,之后當我打開任何 jupyter 筆記本時,kernel 將無法工作。 我在激活環境時復制了這些消息。 如何恢復我的 anaconda 環境? 我已經卸載了 Visual Studio 並刪除了它的所有文件,但問題仍然存在。 感謝您為解決此問題提供的任何幫助。 我正在使用 Windows 10 和 Anaconda 3。

(base) C:\>conda activate enviro

C:\>SET DISTUTILS_USE_SDK=1

C:\>SET MSSdk=1

C:\>SET "VS_VERSION=15.0"

C:\>SET "VS_MAJOR=15"

C:\>SET "VS_YEAR=2017"

C:\>set "MSYS2_ARG_CONV_EXCL=/AI;/AL;/OUT;/out"

C:\>set "MSYS2_ENV_CONV_EXCL=CL"

C:\>set "PY_VCRUNTIME_REDIST=\bin\vcruntime140.dll"

C:\>set "CXX=cl.exe"

C:\>set "CC=cl.exe"

C:\>set "VSINSTALLDIR="

C:\>for /F "usebackq tokens=*" %i in (`vswhere.exe -nologo -products * -version [15.0,16.0) -property installationPath`) do (set "VSINSTALLDIR=%i\" )

C:\>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:\>if not exist "" (set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\" )

C:\>if not exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\" (set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\" )

C:\>if not exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\" (set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\" )

C:\>if not exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\" (set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\" )

C:\>IF NOT "" == "" (
set "INCLUDE=;"
 set "LIB=;"
 set "CMAKE_PREFIX_PATH=;"
)

C:\>call :GetWin10SdkDir

C:\>call :GetWin10SdkDirHelper HKLM\SOFTWARE\Wow6432Node  1>nul 2>&1

C:\>if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE\Wow6432Node  1>nul 2>&1

C:\>if errorlevel 1 call :GetWin10SdkDirHelper HKLM\SOFTWARE  1>nul 2>&1

C:\>if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE  1>nul 2>&1

C:\>if errorlevel 1 exit /B 1

C:\>exit /B 0

C:\>for /F %i in ('dir /ON /B "\include\10.*"') DO (SET WindowsSDKVer=%~i )
The system cannot find the file specified.

C:\>if errorlevel 1 (echo "Didn't find any windows 10 SDK. I'm not sure if things will work, but let's try..." )  else (echo Windows SDK version found as: "" )
Windows SDK version found as: ""

C:\>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:\>pushd C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
The system cannot find the path specified.

C:\>CALL "VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.16
The system cannot find the path specified.

C:\>popd

C:\>IF "" == "" SET "CMAKE_GENERATOR=Visual Studio 15 2017 Win64"

C:\>call :GetWin10SdkDirHelper HKLM\SOFTWARE\Wow6432Node  1>nul 2>&1

C:\>if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE\Wow6432Node  1>nul 2>&1

C:\>if errorlevel 1 call :GetWin10SdkDirHelper HKLM\SOFTWARE  1>nul 2>&1

C:\>if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE  1>nul 2>&1

C:\>if errorlevel 1 exit /B 1

C:\>exit /B 0

(enviro) C:\>

通過刪除Anaconda3\envs\enviro\etc\conda\activate.d中的vs2017_compiler_vars文件解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM