问题
Just as the question states, I'm interested in the WHY. What exactly is happening that the numpy package cannot be installed without it?
回答1:
Two main things you need to know:
- Python packages are usually distributed as sources (though there's an ongoing effort to ship them as binary wheels instead).
- Python packages sometimes include C or C++ code. That's the case for Numpy (but a lot of other packages don't).
But, when you install a package from source, and it includes C or C++ code, you need to compile that code to run it (unlike Python code, which is interpreted).
But, to compile C / C++ code, you need a C / C++ compiler. As it turns out, Visual C++ ships with a C / C++ compiler (and it's the standard for Windows).
Note that if you were using Linux instead of Windows, you'd want to install gcc
(or clang
) instead.
来源:https://stackoverflow.com/questions/32593020/why-is-visual-c-installer-necessary-to-install-numpy-package-for-python