Why is Visual C++ Installer necessary to install numpy package for Python?

断了今生、忘了曾经 提交于 2020-06-27 04:43:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!