问题
Hi so I was trying to pip install python-ldap
using my git bash but at first it told me that i don't have cl.exe
so i downloaded the visual studio C++ pack now it's showing this error
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
I never coded with C++ so I'm not sure what the error is. I downloaded the CLI tools for C++ too and I don't think it's because the cl.exe
isn't in the path since it found it. Any insights ??
回答1:
There doesn't seem to be a valid solution for this error but one workaround is to install the windows binary package from https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap
回答2:
In my case, I had to copy or link (using link shell extension) the x64 version of "C Connector" to the x86 folder.
If you can't find the x64 C connector...
- Download
mysql-installer-web-community-8.0.12.0.msi
from their website: https://dev.mysql.com/downloads/installer/ - Run the Installer, and click the
Add
button on the right, then locate theConnector C 6.1 x64
The C++ Connector has C compatible header files, but hard-linking to it does not work, as explained here: https://dev.mysql.com/downloads/connector/c/
You cannot install the x86 version alongside the x64 version. The installer does not permit this.
Otherwise, Hard-Link the x64 version
- Install link shell extension.
- Navigate to "C:\Program Files\MySQL\" then right click on "MySQL Connector C 6.1" and click
Pick Link Source
- Navigate to "C:\Program Files (x86)\MySQL\" and
Drop Link As...
>Junction
- A Junction is a duplicate reference in the file system to a folder. Creating a second junction reclassifies the original folder a junction as well, but they are both authentic references to the same folder, and so, unlike symbolic links, they will work with scripts, because they are real, and are implemented on the file system level.
Then, if the connector you have installed is a different version number and you want to try to force it to work with a non-compatible script, rename it to match the folder mentioned in the error message. For example...
- C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726
\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,3,13,'final',0) -D__version__=1.3.13 "-I
C:\Program Files (x86)\MySQL\MySQL Connector C 6.1
\include" "-Ic:\program files\python37\include" "-Ic:\program files\python37\include" "-IC:\Program Files (x86)\Microsoft Visu...
- C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726
\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,3,13,'final',0) -D__version__=1.3.13 "-I
Crappy pip code failing to pass variables from the system environment :(
回答3:
Install Visual C++ 2015 Build Tools from https://go.microsoft.com/fwlink/?LinkId=691126 with default selection.
来源:https://stackoverflow.com/questions/50494411/error-command-c-visual-studio-2017-community-vc-tools-msvc-14-14-2642