我已经安装了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正确安装模块。


当前回答

要扩展ocean800、davidsheldon和user3661384的答案:

你现在应该不再使用Visual Studio Tools 2015,因为有一个更新的版本可用。正如Python文档所指出的,您应该使用Visual Studio Tools 2017。

Visual c++ Build Tools 2015由微软升级为Visual Studio Build Tools 2017。

从这里下载。

您还需要setuptools。如果你没有安装工具,运行:

pip install setuptools

或者如果你已经有了,一定要升级它。

pip install setuptools --upgrade

对于上面的Python文档链接,您将看到setuptools版本必须至少为34.4.0才能使Visual Studio工具工作。

其他回答

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

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

对于Python 3.7.4,以下一组命令可以工作: 在执行这些命令之前,您需要确认Visual Studio中已经安装了Desktop with c++ and Python。

cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"
vcvarsall.bat x86_amd64
cd \
set CL=-FI"%VCINSTALLDIR%\tools\msvc\14.16.27023\include\stdint.h"
    
pip install pycrypto

要解决以下任何错误:

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

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

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

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

pip install filename

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

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

在我的Windows 10电脑上安装Scrapy网页抓取Python框架时,我遇到了同样的问题。我是这样想出解决办法的:

从这个链接下载最新的(最后一个)车轮文件:车轮文件扭曲包 我建议将wheel文件保存在Python安装的目录中,即本地C盘的某个位置: 然后进入wheel文件所在的文件夹,运行pip install <*wheel文件的名称*> 最后,再次运行pip install Scrapy命令,你就可以使用Scrapy或任何其他需要你下载大量Windows c++包/SDK的工具了。

免责声明:当我尝试安装Scrapy时,这个解决方案对我有效,但我不能保证在安装其他软件、软件包等时也能奏效。