关于tensorflow:TensorFlow之安装篇

3次阅读

共计 743 个字符,预计需要花费 2 分钟才能阅读完成。

1.windws 下 linux 环境搭建
在 windows10 上装置 linux 子系统的步骤,详见 https://www.linuxprobe.com/wi…。
我抉择的 Ubuntu 子系统如下

环境阐明:
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…

正文完
 0