You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Anaconda安装Python模块时Visual Studio版本兼容问题求助

使用VS2022解决Conda安装cuda-compiler时的VSINSTALLDIR缺失问题

问题描述

我在conda环境中安装Python模块时,安装deepspeed提示缺少NVCC,于是执行命令conda install -c nvidia cuda-compiler,但出现如下报错:

C:\TortoiseTTS>CALL C:\Users\FuckOffWindows\miniconda3\envs\tortoise-voice\etc\conda\activate.d\vs2017_get_vsinstall_dir.bat
Did not find VSINSTALLDIR
Windows SDK version found as: "10.0.22621.0"
The system cannot find the path specified.
Did not find VSINSTALLDIR

我没有Visual Studio 2017,也无法下载旧版构建工具,想问能不能用VS2022解决?我已经试过重装相关包、安装VS2022构建工具、卸载VS2019。

解决方案

可以用VS2022解决,核心是让conda的cuda-compiler能识别到VS2022的环境,具体步骤如下:

  • 确保VS2022已安装Desktop development with C++ workload,并且勾选报错中显示的Windows SDK版本(10.0.22621.0)。
  • 手动设置环境变量VSINSTALLDIR:
    • 系统环境变量添加:变量名VSINSTALLDIR,变量值设为VS2022的安装路径(默认如C:\Program Files\Microsoft Visual Studio\2022\Community)。
    • 或激活conda环境后临时设置:执行命令 set VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio\2022\Community。
  • 禁用VS2017检测脚本:找到报错路径中的vs2017_get_vsinstall_dir.bat文件,重命名为vs2017_get_vsinstall_dir.bat.bak,避免conda激活时触发该脚本。
  • 重新激活conda环境,再次尝试安装cuda-compiler或直接安装deepspeed。

另一种替代方案:直接从NVIDIA官网下载对应版本的CUDA Toolkit(包含NVCC),安装后配置环境变量,无需依赖conda的cuda-compiler包即可满足deepspeed的编译需求。

内容的提问来源于stack exchange,提问作者Zeemeeuw

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 16:19:55