最近学习tensorflow,学习记录,加深印象。
1. 安装,没有安装anc,win10之前配置了python2、3的环境。
tensorflow支持python3。
管理员打开cmd输入:
>pip3 install --upgrade tensorflow
安装好之后,ipython:
ipytohn
import tensorflow
出现错误:
ImportError: Could not find 'msvcp140.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. You may install this DLL by downloading Visual C++ 2015 Redistributable Update 3 from this URL: https://www.microsoft.com/en-us/download/details.aspx?id=53587
解决方案:安装微软为VS2015提供的组件Visual C++ Redistributable for Visual Studio 2015,网址:
https://www.microsoft.com/zh-CN/download/details.aspx?id=48145
下载后直接安装就OK。
继续import,没有报错。emmmmm.....可能OK了?跑个输出吧。
输出例子:
import tensorflow as tf
out = tf.constant("hello world!")
session = tf.Session()
print(session.run(out))
结果:
图中格式呢 是vscode+jupyter 插件搞得 跑一些段代码还是很方便的。完了记录一下;感觉好多东西都忘记了,不记下来,再看的时候完全懵.....是时候博客搞起来了。