
ubuntu装TensorFlow-GPU2.1.0
发布日期:2021-05-14 03:20:08
浏览次数:24
分类:精选文章
本文共 1390 字,大约阅读时间需要 4 分钟。
Ubuntu 安装TensorFlow-GPU 2.1.0 指南
在 Ubuntu 16.04 系统上安装TensorFlow-GPU 2.1.0 可能会遇到一系列问题。本文将详细介绍所需步骤,包括代码环境设置和TensorFlow的安装及配置。
一、 添加Anaconda下载源
由于网络限制,建议添加清华大学镜像源,确保Anaconda能够顺利下载所需文件。
执行以下命令以添加镜像源:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --set show_channel_urls yes
验证是否成功添加源:
conda info
二、 创建并激活虚拟环境
创建一个基于 Python 2.7 的虚拟环境(与安装TensorFlow-GPU 2.1.0兼容)。
命令示例:
conda create -n py27_tf120 python=2.7
/',div>
激活虚拟环境conda activate py27_tf120
'/
三、 安装TensorFlow-GPU 2.1.0
使用 conda
Command Chart安装TensorFlow-GPU:
conda install tensorflow-gpu=2.1.0
安装过程中可能会自动升级 Python 至 3.7。如果需要保持 Python 2.7,可以在安装完成后手动降级:
pip install --user python=3.7
四、 测试安装
验证TensorFlow-GPU 是否成功安装。
测试TensorFlow 1.x版本:
import tensorflow as tfhello = tf.constant('Hello, TensorFlow!')sess = tf.Session()print(sess.run(hello))
测试TensorFlow 2.x版本:
import tensorflow as tftf.compat.v1.disable_eager_execution()hello = tf.constant('hello, tensorflow')sess = tf.compat.v1.Session()print(sess.run(hello))
五、 虚拟环境管理
移除TensorFlow包
conda remove -n py27_tf120 tensorflow-gpu=2.1.0
移除虚拟环境
conda remove -n py27_tf120 --all
检查包版本
conda search tensorflow-gpu
获取Python 二的路径
which python2
列出环境列表
conda env list
如以上步骤完成后,TensorFlow-GPU 2.1.0 应该已成功安装。
⚠️ 注意事项:安装过程中可能会升级系统软件,请确保系统稳定。
如有疑问,请连接社区讨论。
发表评论
最新留言
初次前来,多多关照!
[***.217.46.12]2025年04月26日 10时50分39秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
如何复用外部shell脚本
2019-03-11
JAVA集合类Collection浅析
2019-03-11
获取linux 主机cpu类型
2019-03-11
限流的算法有哪些?
2019-03-11
Failed to notify build listener.
2019-03-11
TextWiew单个线条
2019-03-11
Android Studio updating indices 一直刷新和闪烁
2019-03-11
个人购买服务器问题?
2019-03-11
pwntools编写技巧
2019-03-11
How2Heap笔记(三)
2019-03-11
阿里云轻量云GPU服务器配置
2019-03-11
go--microSocket服务端 php客户端
2019-03-11
如何修改Pspice元件库中元件的模型参数?
2019-03-11
51单片机汇编程序——查表
2019-03-11
小程序提交新数据后如何返回上一页并刷新数据?
2019-03-11
qt c++实现的ai贪吃蛇吃满屏幕,超详细!(二)ai的具体实现
2019-03-11
linux 查看log日志相关命令
2019-03-11
IDEA 2019 安装 mybatis-plus插件
2019-03-11
div 实现光标悬停变成手型
2019-03-11
layer.confirm 无效
2019-03-11