参考网址:https://www.tensorflow.org/install/pip
1.下载Microsoft Visual C++ 2015 Redistributable Update 3
https://www.microsoft.com/zh-CN/download/details.aspx?id=53587
2.启用长路径。
https://superuser.com/a/1119980
3. 安装Python3.6,在安装界面上勾选添加环境变量复选框(不能安装3.7,原因3.7是未被支持,请查看上面参考网址最底部)
4.升级pip(建议使用cmd,中文不会变乱码)
$ python -m pip install --upgrade pip
$ python -m pip install --upgrade setuptools
3.安装(安装时间很长)
$ python -m pip install tensorflow==2.0.0-beta0
4.测试
$ python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
错误:
查看官方:https://www.tensorflow.org/install/errors
ImportError: DLL load failed: 动态链接库(DLL)初始化例程失败。
原因:缺少 Microsoft Visual C++ 2015 Redistributable Update 3,即使安装了2017也会出现这样错误