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


当前回答

要解决以下任何错误:

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

再加上乔杜里的回答:

在我的情况下,我得到了另一个关于lxml的错误如下:

copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-3.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

我必须安装lxml - 4.2.3 - cp37 - cp37m - win_amd64。与Sushant Chaudhary的回答一样,成功完成Scrapy的安装。

下载lxml 4.2.3——cp37 cp37m——win_amd64。whl来自Lxml 把它放在Python安装的文件夹里 使用PIP Install <file-name>安装它

现在您可以运行pip install scrapy。

在为Django项目安装mysqlclient时,我也遇到了同样的问题。

在我的例子中,是系统架构不匹配导致了这个问题。我的系统上有Windows 7 64位版本。但是,我错误地安装了Python 3.7.2 32位版本。

所以,我重新安装Python解释器(64位)并运行命令

pip install mysqlclient

我希望这也适用于其他Python包。

我只是在使用最新的Python 3.6时遇到了同样的问题。Windows OS 10家庭版和64位操作系统。

解决方法:

通过控制面板卸载任何版本的Visual Studio 安装Visual Studio 2015并选择将安装的默认选项 Visual c++ 14.0 您可以使用PyCharm安装Scrapy:菜单项目→项目解释器→+(安装Scrapy) 通过导入检查REPL和PyCharm中的Scrapy。您应该不会看到任何错误。

我有完全相同的问题,并通过安装mysql-connector-python解决了它:

pip install mysql-connector-python

我使用的是Python 3.7和Windows 10,安装Microsoft Build Tools for Visual Studio 2017(如这里所述)并没有解决我的问题,这与您的问题相同。