为什么 tensorflow 需要 VC++ 而 numpy 不需要?
Why VC++ is required for tensorflow while not for numpy?
这听起来可能很愚蠢,但在 python 工作了这么多年之后,我想了解为什么安装 numpy 而 tensorflow 要求 Microsoft VC++ 安装 Windows。常识说两者都是用 C++ 编写的。那么为什么前一个包安装没有任何问题,而后一个包要求 VC++?
VC++ 要求从 2.1 版开始存在。 release notes of the version 2.1 状态:
Windows users: Officially-released tensorflow Pip packages are now
built with Visual Studio 2019 version 16.4 in order to take advantage
of the new /d2ReducedOptimizeHugeFunctions compiler flag. To use these
new packages, you must install "Microsoft Visual C++ Redistributable
for Visual Studio 2015, 2017 and 2019", available from Microsoft's
website here.
- This does not change the minimum required version for building TensorFlow from source on Windows, but builds enabling
EIGEN_STRONG_INLINE can take over 48 hours to compile without this
flag. Refer to configure.py for more information about
EIGEN_STRONG_INLINE and /d2ReducedOptimizeHugeFunctions.
- If either of the required DLLs, msvcp140.dll (old) or msvcp140_1.dll (new), are missing on your machine, import tensorflow
will print a warning message.
此更改使得 Windows tensorflow 包依赖于一些 C++ API,这些在 Windows 机器上默认不可用。您可以阅读有关该问题的更多信息:Why does my application require Visual C++ Redistributable package
这听起来可能很愚蠢,但在 python 工作了这么多年之后,我想了解为什么安装 numpy 而 tensorflow 要求 Microsoft VC++ 安装 Windows。常识说两者都是用 C++ 编写的。那么为什么前一个包安装没有任何问题,而后一个包要求 VC++?
VC++ 要求从 2.1 版开始存在。 release notes of the version 2.1 状态:
Windows users: Officially-released tensorflow Pip packages are now built with Visual Studio 2019 version 16.4 in order to take advantage of the new /d2ReducedOptimizeHugeFunctions compiler flag. To use these new packages, you must install "Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019", available from Microsoft's website here.
- This does not change the minimum required version for building TensorFlow from source on Windows, but builds enabling EIGEN_STRONG_INLINE can take over 48 hours to compile without this flag. Refer to configure.py for more information about EIGEN_STRONG_INLINE and /d2ReducedOptimizeHugeFunctions.
- If either of the required DLLs, msvcp140.dll (old) or msvcp140_1.dll (new), are missing on your machine, import tensorflow will print a warning message.
此更改使得 Windows tensorflow 包依赖于一些 C++ API,这些在 Windows 机器上默认不可用。您可以阅读有关该问题的更多信息:Why does my application require Visual C++ Redistributable package