错误:命令“C:\\ Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x64\\cl.exe”失败,退出状态为 2

UWG*_*OSE 8 c++ pip visual-studio visual-c++

嗨,所以我试图pip install python-ldap使用我的 git bash,但起初它告诉我我没有,cl.exe所以我下载了 Visual Studio C++ 包,现在它显示了这个错误

 error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
Run Code Online (Sandbox Code Playgroud)

我从来没有用 C++ 编码,所以我不确定错误是什么。我也下载了 C++ 的 CLI 工具,我不认为这是因为cl.exe它在找到它后不在路径中。任何见解?

Nad*_*hne 11

我知道这个问题是几年前提出的,但对于未来的用户,我想为这个问题提供答案。今天,我在使用“Microsoft Visual Studio 2019 构建工具”时遇到了同样的问题。

error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
Run Code Online (Sandbox Code Playgroud)

我在尝试在 Windows 操作系统中通过 anaconda3 cmd 安装依赖项时遇到了这个问题。

pip install sparse_dot_topn
Run Code Online (Sandbox Code Playgroud)

我尝试了不同门户网站中建议的不同方法,但几个小时都无法解决此问题。同时,我最终也安装了 Visual Studio 构建工具中不必要的组件。最后发现问题与安装工具库有关,可以通过强制升级安装工具包解决问题

python -m pip install -U pip setuptools
Run Code Online (Sandbox Code Playgroud)

  • 不适合我:( (2认同)

UWG*_*OSE 7

对于此错误似乎没有有效的解决方案,但一种解决方法是从https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap安装 Windows 二进制包

  • 安装非官方的Windows库是否安全 (2认同)

ASH*_*Hu2 5

https://go.microsoft.com/fwlink/?LinkId=691126使用默认选择安装 Visual C++ 2015 Build Tools 。