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


当前回答

我也有同样的问题。下载Visual Studio 2017的构建工具对我有用。

其他回答

要解决以下任何错误:

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 c++ 2015 Build Tools。它将自动下载visualcppbuildtools_full.exe并安装Visual c++ 14.0,而无需实际安装Visual Studio。

安装完成后,重试pip install,您将不会再次得到错误。

我已经在以下平台和版本上进行了测试:

Python 3.6 on Windows 7 64-bit
Python 3.8 on Windows 10 64-bit

我在安装pymssql时遇到了类似的情况。

pip试图构建这个包,因为Python 3.6和Windows没有正式的轮子。

我从非官方的Windows二进制for Python扩展包下载了一个非官方的轮子。

特别针对您的情况:MySQL-python

执行vcvars64.bat

在无休止地搜索类似的问题,但没有一个解决方案。 -添加无尽的文件夹到我的路径和删除他们。卸载和重新安装visual studio社区和构建工具。 一步一步地尝试调试,我终于找到了一个适合我的解决方案。

(如果有人有类似情况,请提供背景说明) 我最近重置了我的主计算机,在重新安装了最新版本的python (Python3.9)库之后,我曾经安装过,没有任何麻烦(主要示例pip install opencv-python)

cl
    is not a full path and was not found in the PATH.

将cl添加到路径from之后 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\Hostx64\x64

和几个不同的Windows套件,一次得到以下。

The C compiler

"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe"

is not able to compile a simple test program.

各种链接错误或“运行构建命令:jom /nologo cmTC_7c75e\fast &&系统无法找到指定的文件”

从常规命令行和管理命令行升级setuptools和wheel,与手动下载wheel或尝试使用——only-binary:all安装相比,没有任何作用:

最后,为我工作的最终结果是运行正确的vcvars.bat为我的python安装,即运行 “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat”一次(不是vcvarsall或vcvars32)(因为我安装的python是64位),然后运行常规命令pip install opencv-python工作。

确保您已经安装了这些必需的软件包。当我安装检查包时,它在我的情况下完美地工作: