安装visual studio 2019后如何正确激活anaconda环境

问题描述 投票:0回答:2

安装Visual Studio 2019后,我的anaconda出现问题。当我在我的 anaconda 中创建一个新的环境时,几个小时后我在尝试激活环境时遇到了问题,之后当我打开任何 jupyter notebook 时,内核将无法工作。我在激活环境时复制了消息。如何恢复我的 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:\>
python visual-studio anaconda environment
2个回答
1
投票

通过删除

vs2017_compiler_vars
中的
Anaconda3\envs\enviro\etc\conda\activate.d
文件解决了。


0
投票

问题是由 conda 包

vswhere
引起的,我相信它是与
vs2017_win-64
一起安装的。

问题仍然悬而未决。见https://github.com/conda/conda/issues/10931

因此,如果您不需要在 conda 环境中集成 Visual Studio,则应卸载具有依赖项的包。

conda uninstall vswhere

但是如果你需要 VS2017,例如像

theano-pymc
这样的编译库的依赖项,那么安装正确的 Visual Studio 或手动调整你的环境变量:
VSINSTALLDIR
等。 要仅删除此详细包,请使用:

conda remove vswhere --force -y

© www.soinside.com 2019 - 2024. All rights reserved.