我已经安装了Python 3.5,并且正在运行

pip install mysql-python

它给出了如下错误

错误:Microsoft Visual c++ 14.0是必需的(无法找到vcvarsall.bat)

我已经添加了以下行到我的路径

C:\Program Files\Python 3.5\Scripts\;
C:\Program Files\Python 3.5\;

C:\Windows\System32;
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC;
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC

我的电脑上安装了64位的Windows 7。

什么解决方案可以减少这个错误,并通过pip正确安装模块。


当前回答

这里和其他地方的解决方案都不适合我。我的64位Windows 10操作系统上安装了一个不兼容的32位版本的mysqlclient,因为我使用的是32位版本的Python。

我不得不卸载我目前的Python 3.7 32位,并重新安装Python 3.7 64位,现在一切都很好。

其他回答

使用这个可以节省时间

pip install pipwin 
pipwin install yourLibrary

pipwin类似于pip,但它安装由Christoph Gohlke提供的预编译的Windows二进制文件。节省了你大量的时间搜索和下载。

在这种情况下,pipwin会解决问题

Error: Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)

阅读更多关于pipwin的信息,这里他们提到了Microsoft Visual c++

我也有同样的问题。我需要一个64位版本的Python,所以我安装了3.5.0(撰写本文时最新的版本)。切换到3.4.3之后,我的所有模块安装都正常了。

Python Windows版本

要解决以下任何错误:

misaka的车轮建造失败 建造misaka失败 需要Microsoft Visual c++ 14.0 无法找到vcvarsall.bat

解决方案是:

Go to Build Tools for Visual Studio 2017 Select free download under Visual Studio Community 2017. This will download the installer. Run the installer. Select what you need under workload tab: a. Under Windows, there are three choices. Only check Desktop development with C++. b. Under Web & Cloud, there are seven choices. Only check Python development (I believe this is optional, but I have done it). In cmd, type pip3 install misaka. Note if you already installed Visual Studio then when you run the installer, you can modify yours (click modify button under Visual Studio Community 2017) and do steps 3 and 4. Final note: If you don't want to install all modules, having the three below (or a newer version of the VC++ 2017) would be sufficient. (You can also install the Visual Studio Build Tools with only these options, so you don’t need to install Visual Studio Community Edition itself) => This minimal install is already a 4.5 GB, so saving off anything is helpful

你的路径只列出了Visual Studio 11和12,它需要14,也就是Visual Studio 2015。如果你安装了它,并记得勾选Languages→c++,那么它应该可以工作。

在我的Python 3.5安装中,错误消息更有用一些,并包含了获取它的URL:

错误:需要Microsoft Visual c++ 14.0。通过“Microsoft Visual c++ Build Tools”获取:http://landinghub.visualstudio.com/visual-cpp-build-tools

新的工作环节。

根据Fire的建议,你可能还需要升级setuptools包来消除错误:

pip install --upgrade setuptools

我也面临着同样的问题。下面的方法对我很有效:

根据系统上安装的Python版本,从Christoph Gohlke安装程序站点下载非官方二进制文件。

导航到安装文件的文件夹并运行

pip install filename

python_ldap - 3.0.0 - cp35 - cp35m - win_amd64。我的机器是64位,Python版本是3.5。

这成功地在我的Windows机器上安装了python-ldap。您可以对mysql-python尝试同样的方法。