Ubuntu16.04版本安装Anaconda+Tensorflow

本文详细介绍了在Ubuntu16.04系统中如何轻松安装Anaconda和Tensorflow。首先从Anaconda官网下载适用于Ubuntu的安装文件,通过bash命令完成安装。接着在Anaconda环境下创建名为tensorflow的conda环境,激活并安装Tensorflow。提供了直接下载文件安装和使用pip安装两种方法,帮助读者避免安装过程中的常见问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Ubuntu16.04版本安装Anaconda+Tensorflow

     

Ubuntu16.04系统下安装软件一直是“心头大患”,特别是安装Anacondahe和Tensorflow,可以说是一波三折。为了不让大家走弯路,快速的完成Anacondahe和Tensorflow的安装使用,本文结合自身的亲身体验介绍一个进行成功案列,既简单又实用。安装前确保Ubuntu16.04已经安装好,方法步骤:

1.安装Anaconda

首先到Anaconda官网点击打开链接下载安装文件,由于是Ubuntu16.04系统,这里下载Anaconda3-4.2.0-Linux-x86_64.sh版本(Python for 3.5)。

下载完成后将.sh文件放到目录下(本人放到/home/guoguo16/下载目录下)。

然后打开终端(Terminal),输入命令cd/home/guoguo16/下载(根据个人放的目录进行改变)

最后在文件路径下执行命令:bash Anaconda3-4.2.0-Linux-x86_64.sh

即可完成安装Anaconda,可通过输入命令python进行验证。

2.安装Tensorflow

由于已安装完成了Anaconda(以Python=3.5为例),本文将在Anaconda环境下通过下面步骤进行安装:

(1)首先创建名为tensorflow的conda环境,在终端输入命令:

$ conda create -n tensorflow

(2)激活conda,进入tensorflow环境

 
 
$ source activate tensorflow
(tensorflow)$ # Your prompt should change

附:退出tensorflow环境可执行

$ source deactivate tensorflow

3)安装tensorflow,在这里介绍两种方法(都需要连网)

  ①直接下载tensorflow安装文件点击打开链接,然后cd到tensorflow存放目录下,执行命令:

(tensorflow)$pip install --ignore-installed --upgrade /home/guoguo16/下载/tensorflow_gpu-1.3.0-cp35-cp35m-linux_x86_64.whl

即可安装完成。

②直接安装,执行命令:

(tensorflow)$ pip install --ignore-installed --upgrade \https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.3.0-cp35-cp35m-linux_x86_64.whl

(4)验证,在终端输入python进入环境

执行以下代码:

#Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
若输出:

Hello, TensorFlow!

则安装成功!

提示:在执行sess = tf.Session()时,会出现:

W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
Those are warnings, not errors (as indicated by theW after the colon. Errors have an E there)

到这里大家已经成功安装Anaconda+Tensorflow,可以尽情享受Tensorflow带来的乐趣了,我的Weibo将于大家一起分享最前沿的人工智能、机器学习、深度学习与计算机视觉方面的技术。





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值