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


当前回答

哦!看起来他们在PyPI上没有Windows轮子。

与此同时,从源代码安装可能是有效的,或者尝试下载msvc++ 14,根据错误消息和本页其他人的建议。

Christoph的网站也有非官方的Python扩展包的Windows二进制文件(。whl文件)。

按照以下链接中提到的步骤安装二进制文件:

直接在基本Python中 在虚拟环境和PyCharm

也检查:

文件名。本平台不支持WHL轮

其他回答

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

解决方法:

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

我在windows 10 python版本3.8上也遇到了同样的问题。 在我的情况下,我需要安装mysqlclient错误发生Microsoft Visual c++ 14.0是必需的。因为安装visual studio和它的包可能是一个乏味的过程,下面是我所做的:

步骤1 -从任何浏览器转到非官方的python二进制文件并打开它的网站。

第2步-按ctrl+F并键入任何你想要的。在我的例子中,它是mysqlclient。

步骤3 -进入它,并根据你的python版本和windows系统选择。在我的例子中,它是mysqlclient - 1.4.6 - cp38 - cp38 - win32。WHL并下载。

步骤4 -打开命令提示符并指定下载文件的路径。在我的例子中,它是c:\用户\用户\下载

第5步-输入PIP install .\mysqlclient‑1.4.6‑cp38‑cp38‑win32。WHL,按enter。

这样它就安装成功了,之后我去我的项目终端重新输入所需的命令。这解决了我的问题

请注意,在pycharm中处理项目时,我还尝试从项目解释器安装mysql-client。但是mysql-client和mysqlclient是不同的东西。我不知道为什么,它没有工作。

我尝试了以上所有的方法,没有一个奏效。就在注册这个漏洞之前,我发现了另一个错误的原因:在Windows上使用了错误的shell。

Conda init cmd.exe

帮我搞定了。希望它也能拯救其他人。

要解决以下任何错误:

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

二进制安装它的简单方法!

使用pip的二进制选项。例如,对于mysqlclient:

pip install --only-binary :all: mysqlclient

许多包不会为每个单独的版本创建一个构建,这迫使您的pip从源代码构建。如果您乐于使用最新的预编译二进制版本,请使用——only-binary:all:允许pip使用较旧的二进制版本。