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


当前回答

只要去https://www.lfd.uci.edu/~gohlke/pythonlibs/找到适合你的包(whl文件)。下载它。在cmd中进入下载文件夹,或者在文件夹的地址栏上输入'cmd'。执行如下命令:

pip install mysqlclient-1.4.6-cp38-cp38-win32.whl

(请正确输入文件名。我只是举了一个例子)。无需安装6GB大小的build toll cpp,您的问题将得到解决。

其他回答

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

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

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

执行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工作。

我在安装mayavi时遇到了这个问题。

我还犯了一个常见错误:在pip安装库时需要Microsoft Visual c++ 14.0。

在浏览了许多网页和这个问题的解决方案后,没有一个可行,我想出了这些步骤(大部分取自以前的解决方案)可以让这个问题起作用。

Go to Build Tools for Visual Studio 2017 and install Build Tools for Visual Studio 2017. Which is under All downloads (scroll down) → Tools for Visual Studio 2017 If you have already installed this, skip to 2. Select the C++ components you require (I didn't know which I required, so I installed many of them). If you have already installed Build Tools for Visual Studio 2017 then open the application Visual Studio Installer then go to Visual Studio Build Tools 2017 → Modify → Individual Components and selected the required components. From other answers, important components appear to be: C++/CLI support, VC++ 2017 version <...> latest, Visual C++ 2017 Redistributable Update, Visual C++ tools for CMake, Windows 10 SDK <...> for Desktop C++, Visual C++ Build Tools core features, Visual Studio C++ core features. Install/Modify these components for Visual Studio Build Tools 2017. This is the important step. Open the application Visual Studio Installer then go to Visual Studio Build Tools → Launch. Which will open a CMD window at the correct location for Microsoft Visual Studio\YYYY\BuildTools. Now enter python -m pip install --upgrade setuptools within this CMD window. Finally, in this same CMD window, pip install your Python library: pip install -U <library>.

我已经有了vc++的v14+版本,但由于Anaconda遇到了问题。最终,下面的文件代替了使用pip、pipwin或wheel文件。

conda install <package_name_here>

我也有同样的问题。更新setuptools的解决方案

pip install -U setuptools

or

pip install setuptools --upgrade