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

后端 未结 30 2178
谎友^
谎友^ 2020-11-21 07:34

I\'ve installed Python 3.5 and while running

pip install mysql-python

it gives me the following error

error: Microsoft Vi         


        
相关标签:
30条回答
  • 2020-11-21 08:08

    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.

    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.

    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.

    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.

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

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

    0 讨论(0)
  • 2020-11-21 08:08

    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.

    0 讨论(0)
  • 2020-11-21 08:08

    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
    
    0 讨论(0)
  • 2020-11-21 08:09

    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.

    0 讨论(0)
  • 2020-11-21 08:09

    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.

    0 讨论(0)
  • 2020-11-21 08:11

    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.

    0 讨论(0)
提交回复
热议问题