问题:需要Microsoft Visual C ++ 14.0(无法找到vcvarsall.bat)

我已经安装了Python 3.5,并且在运行时

pip install mysql-python

它给我以下错误

error: Microsoft Visual C++ 14.0 is required (Unable to find 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

我的PC上安装了64位win 7。

有什么能减轻这个错误,并通过正确地安装模块的解决方案pip

I’ve installed Python 3.5 and while running

pip install mysql-python

it gives me the following error

error: Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)

I have added the following lines to my Path

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

I have a 64bit win 7 setup in my PC.

What could be the solution for mitigating this error and installing the modules correctly via pip.


回答 0

您的路径仅列出Visual Studio 11和12,需要14,即Visual Studio 2015。如果您安装了该程序,并记住勾选该复选框,Languages->C++那么它应该可以工作。

在我的Python 3.5安装中,错误消息有用得多,并且包含从中获取错误消息的URL。

 error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

编辑:新的工作链接

编辑:根据Lightfire228的建议,您可能还需要升级setuptools软件包以使错误消失:

pip install --upgrade setuptools

Your path only lists Visual Studio 11 and 12, it wants 14, which is Visual Studio 2015. If you install that, and remember to tick the box for Languages->C++ then it should work.

On my Python 3.5 install, the error message was a little more useful, and included the URL to get it from

 error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

Edit: New working link

Edit: As suggested by Lightfire228, you may also need to upgrade setuptools package for the error to disappear:

pip install --upgrade setuptools

回答 1

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

我不敢相信没有人建议过-对pip使用仅二进制选项。例如,对于mysqlclient:

pip install --only-binary :all: mysqlclient

许多软件包不会为每个发行版创建构建,这会迫使您的点子从源代码构建。如果您愿意使用最新的预编译二进制版本,请使用--only-binary :all:允许pip使用较旧的二进制版本。

Binary install it the simple way!

I can’t believe no one has suggested this already – use the binary-only option for pip. For example, for mysqlclient:

pip install --only-binary :all: mysqlclient

Many packages don’t create a build for every single release which forces your pip to build from source. If you’re happy to use the latest pre-compiled binary version, use --only-binary :all: to allow pip to use an older binary version.


回答 2

解决以下任何错误:

  • Failed building wheel for misaka
  • Failed to build misaka
  • Microsoft Visual C++ 14.0 is required
  • Unable to find vcvarsall.bat

解决方案是:

  1. 转到Visual Studio 2017的构建工具

  2. 在Visual Studio Community 2017下选择免费下载。这将下载安装程序。运行安装程序。

  3. 在“工作负载”选项卡下选择所需的内容:

    一个。在Windows下,有3个选择。仅使用C ++检查桌面开发

    b。在“ Web&Cloud”下,有7个选择。仅检查Python开发(我相信这是可选的,但我已经做到了)。

  4. 在cmd中输入 pip3 install misaka 在此处输入图片说明

请注意,如果您已经安装了Visual Studio,则在运行安装程序时可以修改您的安装程序(在Visual Studio Community 2017下单击“修改”按钮)并执行步骤3和4

修改按钮的屏幕截图

最后的注意事项:如果您不想安装所有模块,那么拥有下面的3个模块(或VC ++ 2017的较新版本)就足够了。(您也可以仅使用这些选项来安装Visual Studio Build Tools,因此您不需要安装Visual Studio Community Edition本身)=>此最小安装已经是4.5GB,因此保存所有内容都会有所帮助 C ++编译器所需的模块

To solve any of the following errors:

  • Failed building wheel for misaka
  • Failed to build misaka
  • Microsoft Visual C++ 14.0 is required
  • Unable to find vcvarsall.bat

The Solution is:

  1. Go to Build Tools for Visual Studio 2017

  2. Select free download under Visual Studio Community 2017. This will download the installer. Run the installer.

  3. Select what you need under workload tab:

    a. Under Windows, there are 3 choices. Only check Desktop development with C++

    b. Under Web & Cloud, there are 7 choices. Only check Python development (I believe this is optional But I have done it).

  4. In cmd, type pip3 install misaka enter image description here

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

Screenshot of Modify button

Final Note : If you don’t want to install all modules, having the 3 ones 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 dont need to install Visual Studio Community Edition itself) => This minimal install is already a 4.5GB, so saving off anything is helpful The modules you need for c++ compiler


回答 3

正如其他答复所指出的那样,一种解决方案是安装Visual Studio2015。但是,这需要几个GB的磁盘空间。一种解决方法是安装预编译的二进制文件。该网页http://www.lfd.uci.edu/~gohlke/pythonlibs)包含预编译的二进制许多Python包。下载感兴趣的包你之后,你可以使用安装pip install,例如pip install mysqlclient‑1.3.10‑cp35‑cp35m‑win_amd64.whl

As the other responses pointed out, one solution is to install Visual Studio 2015. However, it takes a few GBs of disk space. One way around is to install precompiled binaries. The webpage http://www.lfd.uci.edu/~gohlke/pythonlibs (mirror) contains precompiled binaries for many Python packages. After downloading the package of interest to you, you can install it using pip install, e.g. pip install mysqlclient‑1.3.10‑cp35‑cp35m‑win_amd64.whl.


回答 4

尝试在Windows 10计算机上安装Scrapy Web抓取Python框架时遇到了确切的问题。我这样想出了解决方案:

  1. 从此链接下载最新的(最后一个)车轮文件👉 扭曲包装的车轮文件 在此处输入图片说明

  2. 我建议将该滚轮文件保存在您安装Python的目录中,即本地磁盘C中的某个位置

  3. 然后访问wheel文件所在的文件夹并运行pip install <*wheel file's name*>

  4. 最后pip install Scrapy再次运行该命令,可以很好地使用Scrapy或其他任何需要下载大量Windows C ++ Package / SDK的工具

免责声明:此解决方案在尝试安装Scrapy时对我有用,但我不能保证在安装其他软件/软件包/等时也会发生这种情况。

I had the exact issue while trying to install Scrapy web scraping Python framework on my Windows 10 machine. I figured out the solution this way:

  1. Download the latest (the last one) wheel file from this link 👉 wheel file for twisted package enter image description here

  2. I’d recommend saving that wheel file in the directory where you’ve installed Python i.e somewhere in Local Disk C

  3. Then visit the folder where the wheel file exists and run pip install <*wheel file's name*>

  4. Finally run the command pip install Scrapy again and you’re good to use Scrapy or any other tool which required you to download massive Windows C++ Package/SDK.

Disclaimer: This solution worked for me while trying to install Scrapy, but I can’t guarantee the same happening while installing other softwares/packages/etc.✌


回答 5

我在尝试安装时遇到了这个确切的问题mayavi

因此,error: Microsoft Visual C++ 14.0 is required在安装库时,我也有共同点。

错误示例

寻找在许多网页和解决方案,这个线程,与后没有他们的工作的。我认为这些步骤(大部分是从以前的解决方案中提取的)使它可以正常工作。

  1. 转到Visual Studio 2017的构建工具并安装Build Tools for Visual Studio 2017。下All downloads向下滚动)>>Tools for Visual Studio 2017
    • 如果已经安装,请跳至2

安装构建工具

  1. 选择C++ Components您需要的(我不知道我需要哪个,所以安装了许多)。
    • 如果已经安装,Build Tools for Visual Studio 2017则打开应用程序,Visual Studio Installer然后转到Visual Studio Build Tools 2017>> Modify>>,Individual Components然后选择所需的组件。
    • 从其他的答案中的重要组成部分似乎是:C++/CLI supportVC++ 2017 version <...> latestVisual C++ 2017 Redistributable UpdateVisual C++ tools for CMakeWindows 10 SDK <...> for Desktop C++Visual C++ Build Tools core featuresVisual Studio C++ core features

选择组件

  1. 为安装/修改这些组件Visual Studio Build Tools 2017

  2. 这是重要的一步。打开应用程序,Visual Studio Installer然后转到Visual Studio Build Tools>> Launch。这将在正确的位置打开CMD窗口Microsoft Visual Studio\YYYY\BuildTools

打开Visual Studio安装程序 启动Visual Studio生成工具 CMD构建工具窗口

  1. 现在,python -m pip install --upgrade setuptools在此CMD窗口中输入。

CMD更新设置工具

  1. 最后,在同一 CMD窗口pip中安装python库:pip install -U <library>

CMD安装Python库

I had this exact issue while trying to install mayavi.

So I also had the common error: Microsoft Visual C++ 14.0 is required when pip installing a library.

Example of Error

After looking across many web pages and the solutions to this thread, with none of them working. I figured these steps (most taken from previous solutions) allowed this to work.

  1. 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.

Installing Build Tools

  1. Select the C++ Components you require (I didn’t know which I required so 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.

Select Components

  1. Install/Modify these components for Visual Studio Build Tools 2017.

  2. 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.

Open Visual Studio Installer Launch Visual Studio Build Tools CMD Build Tools Window

  1. Now enter python -m pip install --upgrade setuptools within this CMD window.

CMD Update Setuptools

  1. Finally, in this same CMD window pip install your python library: pip install -U <library>.

CMD Install Python Library


回答 6

安装spaCy模块时遇到相同的问题。我检查了控制面板,我已经安装了几个可视的C ++可再发行组件。

我所做的是选择已经安装在我的PC上的“ Microsoft Visual Studio Community 2015”->“修改”->选中“ Visual C ++ 2015通用工具”。然后,将花费一些时间并下载超过1 GB的空间进行安装。

这解决了我的问题。现在,我已经安装了spaCy。

I had the same problem when installing spaCy module. And I checked control panel I have several visual C++ redistributables installed already.

What I did was select “Microsoft Visual Studio Community 2015” which is already installed on my PC –> “Modify” –>check “Common Tools for Visual C++ 2015”. Then it will take some time and download more than 1 GB to install it.

This fixed my issue. Now I have spaCy installed.


回答 7

我有同样的问题。更新设置工具的解决方案

pip install -U setuptools

要么

pip install setuptools --upgrade

I had this same problem. A solution for updating setuptools

pip install -U setuptools

or

pip install setuptools --upgrade

回答 8

在阅读了SO中的很多答案并且没有一个有效的方法之后,我终于设法按照线程中的步骤解决了这个问题,如果页面消失了,我将在这里保留这些步骤:

请尝试安装用于Visual Studio 2017的构建工具,选择工作负载“ Visual C ++生成工具”,然后检查选项“ C ++ / CLI支持”和“用于桌面的VC ++ 2015.3 v14.00(v140)工具集”,如下所示。

在此处输入图片说明

希望它对我有帮助。

After reading a lot of answers in SO and none of them working, I finally managed to solve it following the steps in this thread, I will leave here the steps in case the page dissapears:

Please try to install Build Tools for Visual Studio 2017, select the workload “Visual C++ build tools” and check the options “C++/CLI support” and “VC++ 2015.3 v14.00 (v140) toolset for desktop” as below.

enter image description here

Hope it helps as it did for me.


回答 9

确保您已经安装了这些必需的软件包。在我安装已检查的软件包的情况下,可以正常工作 在此处输入图片说明

Make sure that you’ve installed these required packages.Worked perfectly in my case as i installed the checked packages enter image description here


回答 10

为了扩展ocean800davidsheldonuser3661384的答案:

现在,您应该不再使用Visual Studio Tools 2015,因为已有新版本可用。如Python文档所述,您应该改用Visual Studio Tools 2017。

Microsoft已将Visual C ++生成工具2015升级为Visual Studio 2017的生成工具。

这里下载

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

pip install setuptools

或者,如果您已经拥有它,请确保对其进行升级。

pip install setuptools --upgrade

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

To expand on the answers by ocean800, davidsheldon and user3661384:

You should now no longer use Visual Studio Tools 2015 since a newer version is available. As indicated by the Python documentation you should be using Visual Studio Tools 2017 instead.

Visual C++ Build Tools 2015 was upgraded by Microsoft to Build Tools for Visual Studio 2017.

Download it from here

You will require also need setuptools, if you don’t have setup tools run:

pip install setuptools

Or if you already have it, be sure to upgrade it.

pip install setuptools --upgrade

For the Python documentation link above you will see that setuptools version must be at least 34.4.0. for VS Tools to work


回答 11

使用此链接下载和安装Visual C ++ 2015生成工具。它会自动下载visualcppbuildtools_full.exe并安装Visual C ++ 14.0,而无需实际安装Visual Studio。安装完成后,重试pip安装,您将不会再收到错误消息。

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

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

我对这个问题的评论与我有相同的建议,但是,我被要求将其发布为答案,因为它对很多人都有帮助。因此,我将其发布为答案。

Use this link to download and install Visual C++ 2015 Build Tools. It will automatically download visualcppbuildtools_full.exe and install Visual C++ 14.0 without actually installing Visual Studio. After the installation completes, retry pip install and you won’t get the error again.

I have tested it on following platform and versions:

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

I have same suggestion as a comment to the question, however, I have been requested to post this as an answer as it helped a lot of people. So I posted it as an answer.


回答 12

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

pip install mysql-connector-python

我是在python3.7和Windows 10安装Microsoft构建工具为Visual Studio 2017年(描述这里)没有解决我的问题,这是等同于你的。

I had exactly the same issue and solved it by installing mysql-connector-python with:

pip install mysql-connector-python

I am on python3.7 & windows 10 and installing Microsoft Build Tools for Visual Studio 2017 (as described here) did not solve my problem that was identical to yours.


回答 13

我遇到过同样的问题。下载适用于Visual Studio 2017的构建工具对我有用。在这里找到

I had the same issue. Downloading the Build Tools for Visual Studio 2017 worked for me. Find it here


回答 14

使用链接到Visual C ++ 2015生成工具。这将安装Visual C ++ 14.0,而无需安装Visual Studio。

Use the link to Visual C++ 2015 Build Tools. That will install Visual C++ 14.0 without installing Visual Studio.


回答 15

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

解决此问题的步骤:

  1. 通过控制面板卸载您拥有的任何版本的Visual Studio
  2. 安装Visual Studio 2015并选择默认选项,该选项将自行安装Visual C ++ 14.0
  3. 您可以使用Pycharm安装scrapy-> Project-> Project Interpreter-> +(安装scrapy)
  4. 通过导入检查REPL和pycharm中的scrapy,您应该不会看到任何错误

Just had the same issue while using the latest Python 3.6. With Windows OS 10 Home Edition and 64 Bit Operation System

Steps to solve this issue :

  1. Uninstall any versions of Visual studio you have had, through Control Panel
  2. Install Visual Studio 2015 and chose the default option that will install Visual C++ 14.0 on its own
  3. You can use Pycharm for installing scrapy ->Project->Project Interpreter->+ (install scrapy)
  4. check scrapy in REPL and pycharm by import , you should not see any errors

回答 16

安装pymssql时遇到类似情况

pip试图构建该软件包,因为没有
适用于python 3.6和Windows的官方轮子。

通过从此处下载非官方的轮子解决了该问题:http://www.lfd.uci.edu/~gohlke/pythonlibs/

专门针对您的情况-> http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python

had a similar situation installing pymssql

pip was trying to build the package because there were no official wheels
for python 3.6 & windows.

solved it by downloading an unoffical wheel from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/

specifically for your case -> http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python


回答 17

我有同样的问题。我需要一个64位版本的Python,所以我安装了3.5.0(是撰写本文时的最新版本)。切换到3.4.3后,我所有的模块安装均正常。

适用于Windows的Python版本

I had the same problem. I needed a 64-bit version of Python so I installed 3.5.0 (the most recent as of writing this). After switching to 3.4.3 all of my module installations worked.

Python Releases for Windows


回答 18

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

我必须卸载当前的Python 3.7 32bit,然后重新安装Python 3.7 64bit,现在一切正常

None of the solutions here and elsewhere worked for me. Turns out an incompatible 32bit version of mysqlclient is being installed on my 64bit Windows 10 OS because I’m using a 32bit version of Python

I had to uninstall my current Python 3.7 32bit, and reinstalled Python 3.7 64bit and everything is working fine now


回答 19

查看包装是否有包含必要双轮的正式前叉

我需要该软件包python-Levenshtein,发生此错误,然后找到该软件包python-Levenshtein-wheels

Look if the package have an official fork that include the necessary binary wheels.

I needed the package python-Levenshtein, had this error, and find the package python-Levenshtein-wheels instead.


回答 20

只需转到https://www.lfd.uci.edu/~gohlke/pythonlibs/找到合适的软件包(whl文件)。下载它。转到cmd中的下载文件夹,或在文件夹的地址栏上键入“ cmd”。运行命令:

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

(正确输入文件名。我仅给出一个示例)。您的问题将得到解决,而无需安装6GB大小的构建收费cpp。

Just go to https://www.lfd.uci.edu/~gohlke/pythonlibs/ find your suitable package (whl file). Download it. Go to the download folder in cmd or typing ‘cmd’ on the address bar of the folder. Run the command :

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

(Type the file name correctly. I have given an example only). Your problem will be solved without installing build toll cpp of 6GB size.


回答 21

在@Sushant Chaudhary的答案之上添加

就我而言,我又遇到了有关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

我必须以与@Sushant Chaudhary回答相同的方式安装lxml‑4.2.3‑cp37‑cp37m‑win_amd64.whl,才能成功完成Scrapy的安装。

  1. https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml下载lxml‑4.2.3‑cp37‑cp37m‑win_amd64.whl
  2. 将其放在安装了python的文件夹中
  3. 使用安装 pip install <file-name>

现在您可以运行 pip install scrapy

to add on top of @Sushant Chaudhary’s answer

in my case, I got another error regarding lxml as below

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

I had to install lxml‑4.2.3‑cp37‑cp37m‑win_amd64.whl same way as in the answer of @Sushant Chaudhary to successfully complete installation of Scrapy.

  1. Download lxml‑4.2.3‑cp37‑cp37m‑win_amd64.whl from https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
  2. put it in folder where python is installed
  3. install it using pip install <file-name>

now you can run pip install scrapy


回答 22

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

同时,从源代码进行安装可能会起作用,或者尝试按照错误消息中的建议以及此页面上的其他人下载MSVC ++ 14。

Christoph的站点还具有用于Python扩展包(.whl文件)的非官方Windows二进制文件。

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

  1. 直接在基本python中
  2. 在虚拟环境/ Pycharm中

还要检查:

要下载哪个二进制文件?

Oops! Looks like they don’t have Windows wheels on PyPI.

In the meantime, installing from source probably works or try downloading MSVC++ 14 as suggested in the error message and by others on this page.

Christoph’s site also has unofficial Windows Binaries for Python Extension Packages (.whl files).

Follow steps mentioned in following links to install binaries :

  1. Directly in base python
  2. In virtual environments / Pycharm

Also check :

Which binary to download??


回答 23

适用于Python 3.7.4的以下命令集有效:在执行这些命令之前,您需要确认Visual Studio中已安装C ++桌面和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

for Python 3.7.4 following set of commands worked: Before those command, you need to confirm Desktop with C++ and Python is installed in Visual Studio.

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

回答 24

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

就我而言,这是导致问题的系统架构不匹配。我的系统上有Windows 7 64位版本。但是,我已经安装了Python 3.7.2 32错误地位版本。

因此,我重新安装了Python解释器(64位)并运行了命令

pip install mysqlclient

我希望这也可以与其他Python包一起使用。

I had the same issue while installing mysqlclient for the Django project.

In my case, it’s the system architecture mismatch causing the issue. I have Windows 7 64bit version on my system. But, I had installed Python 3.7.2 32 bit version by mistake.

So, I re-installed Python interpreter (64bit) and ran the command

pip install mysqlclient

I hope this would work with other Python packages as well.


回答 25

我在Windows 10 python版本3.8上遇到了完全相同的问题。就我而言,我需要在发生错误时安装mysqlclientMicrosoft Visual C++ 14.0 is required。因为安装Visual Studio及其软件包可能是一个乏味的过程,所以我做了以下工作:

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

第2步-按ctrl + F并输入您想要的任何内容。以我为例,它是mysqlclient。

第3步-进入它,然后根据您的python版本和Windows系统进行选择。就我而言,它是mysqlclient-1.4.6-cp38-cp38-win32.whl并下载。

这里

第4步-打开命令提示符,并指定下载文件的路径。就我而言,它是C:\ Users \ user \ Downloads

步骤5-输入pip install .\mysqlclient‑1.4.6‑cp38‑cp38‑win32.whl并按Enter。

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

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

I had the same exact issue on my windows 10 python version 3.8. In my case, I needed to install mysqlclient were the error occurred Microsoft Visual C++ 14.0 is required. Because installing visual studio and it’s packages could be a tedious process, Here’s what I did:

step 1 – Go to unofficial python binaries from any browser and open its website.

step 2 – press ctrl+F and type whatever you want. In my case it was mysqlclient.

step 3 – Go into it and choose according to your python version and windows system. In my case it was mysqlclient‑1.4.6‑cp38‑cp38‑win32.whl and download it.

here

step 4 – open command prompt and specify the path where you downloaded your file. In my case it was C:\Users\user\Downloads

step 5 – type pip install .\mysqlclient‑1.4.6‑cp38‑cp38‑win32.whl and press enter.

Thus it was installed successfully, after which I went my project terminal re-entered the required command. This solved my problem

Note that, while working on the project in pycharm, I also tried installing mysql-client from the project interpreter. But mysql-client and mysqlclient are different things. I have no idea why and it did not work.


回答 26

我面临着同样的问题。以下对我有用:根据系统上安装的python版本,从Christoph Gohlke安装程序站点下载非官方的二进制文件。导航到已安装文件的文件夹并运行

pip install filename

对我来说python_ldap‑3.0.0‑cp35‑cp35m‑win_amd64.whl,我的机器是64位,而python版本是3.5。这成功在我的Windows机器上安装了python-ldap。您可以为mysql-python尝试相同的操作

I was facing the same problem. The following worked for me: Download the unoffical binaries file from Christoph Gohlke installers site as per the python version installed on your system. Navigate to the folder where you have installed the file and run

pip install filename

For me python_ldap‑3.0.0‑cp35‑cp35m‑win_amd64.whl worked as my machine is 64 bit and python version is 3.5. This successfully installed python-ldap on my windows machine. You can try the same for mysql-python


回答 27

对我来说这工作
pip install –only-binary:all:mysqlclient

This works for me:
pip install --only-binary :all: mysqlclient


回答 28

如果Visual Studio的不是你的东西,而是你正在使用VS代码,那么这个链接会引导你通安装程序来获得C ++在你的Windows上运行。

您只需要完成先决条件部分。 https://code.visualstudio.com/docs/cpp/config-msvc/#_prerequisites

这与其他答案类似,但是此链接的年龄可能会比此处的某些答案更好。

PS:别忘了跑步 pip install --upgrade setuptools

If Visual Studio is NOT your thing, and instead you are using VS Code, then this link will guide you thru the installer to get C++ running on your Windows.

You only needs to complete the Pre-Requisites part. https://code.visualstudio.com/docs/cpp/config-msvc/#_prerequisites

This is similar with other answers, but this link will probably age better than some of the responses here.

PS: don’t forget to run pip install --upgrade setuptools


声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。