TensorFlow之安装篇

1.windws下linux环境搭建
在windows10上安装linux子系统的步骤,详见https://www.linuxprobe.com/wi...
我选择的Ubuntu子系统如下
TensorFlow之安装篇_第1张图片

环境说明:
Ubuntu 20.04.1 LTS
python 3.8(Ubuntu环境自带的)

2.安装pip

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py   # 下载安装脚本
$ sudo python3 get-pip.py    # 运行安装脚本 注意这里我的环境变量是python3

环境说明:
pip 21.0

3.安装tensorflow

#方式1
sudo pip3 install tensorflow

#方式2 先下载,后安装
#2.1 根据环境从https://pypi.org/project/tensorflow/2.4.1/#files下载相应文件
#2.2 安装
sudo pip3 install tensorflow-2.4.1-cp38-cp38-manylinux2010_x86_64.whl

4.验证tensorflow

import tensorflow as tf

tf.compat.v1.disable_eager_execution()
sess = tf.compat.v1.Session()
a = tf.constant(10)
b = tf.constant(12)
sess.run(a+b)

5.参考文献
[1] https://www.linuxprobe.com/wi...
[2] https://www.cnblogs.com/phppe...
[3] https://blog.csdn.net/sinat_3...
[4] https://www.cnblogs.com/zlc36...

你可能感兴趣的:(tensorflow)