Fix the “Microsoft Visual C++ 14.0 is required” error.
When I tried to use python3 to compile and install a module on Windows 10 vim cmd:
python setup.py install
it showed an error:
error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: https://visualstudio.microsoft.com/downloads/
After googling, I found an article1 explaining how to fix the issue but with one correction.
As it1 describes:
- Install using Microsoft Build Tools for Visual Studio 2019.
- Select: Workloads → C++ build tools.
- Install options: select only the “Windows 10 SDK” (assuming the computer is Windows 10). Optionally, if you want to use MSVC cl.exe C/C++ compiler from the command line, additionally select the MSVC 2019 C++ build tools, which takes an additional 1.5 GB disk space …
MSVC 2019 C++ build tools is not optional but required, if you try to compile and install a module via python cmd as I did. After installing both SDK and MSVC, the above cmd runs without any problem.
I understand the
MSVC 2019 C++ build tools installs a C++ compiler on Windows, like the popular gcc compiler on Linux.