在pip install 某依赖文件时出现该报错:error: command ‘cl.exe’ failed with exit status 2,一般该报错还伴随着error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27 出现,这不但是我遇到的问题,在查找了许多方法后,发现很多人也是如此。
关于error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27 的解决方法,通过提示链接下载安装VCForPython就能解决。
而error: command ‘cl.exe’ failed with exit status 2的解决方法我尝试了很多,其中包括参考了这篇博文:Python中安装wordcloud 出现cl.exe failed with exit status 2问题解决 博主的总结是:对python中编译环境C++进行设置并解决模块安装的问题,但是其中列出的解决方法并没有解决我的问题。
我最后是通过下载安装 Python27连接器来解决该问题的,下载完毕直接傻瓜式安装,以管理员身份打开CMD,输入命令行
mklink /d "C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2" "C:\Program Files\MySQL\MySQL Connector C 6.0.2"
python -m pip install MySQL-Python
之后我再pip install安装包就没再报错,成功安装了!不知道这个方法是否对你有帮助。