I\'ve installed Python 3.5 and while running
pip install mysql-python
it gives me the following error
error: Microsoft Vi
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.
Build Tools for Visual Studio 2017
. Which is under All downloads
(scroll down) >> Tools for Visual Studio 2017
C++ Components
you require (I didn't know which I required so installed many of them).
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. 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
.
python -m pip install --upgrade setuptools
within this CMD window.pip install -U <library>
.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.
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
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.
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.
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
.