1 安装Anaconda
官网下载即可
2 TensorFlow环境
(1)cmd打开输入python -V查看python版本(python3.7)
(2)pip 安装
创建环境命名conda create -name tensorflow python=3.7
检查是否创建conda info --envs
激活:activate tensorflow
安装:pip install tensorflow
(3)测试
import tensorflow as tf
(4)jupyter
spyder运行
import tensorflow as tf
W = tf.Variable(tf.ones(shape=(2,2)), name='W')
b = tf.Variable(tf.zeros(shape=(2)), name='b')
@tf.function()
def forward(x):
return W * x + b
out_a = forward([1,0])
print(out_a)
结果