首页 > 技术文章 > ubuntu+anaconda+python安装各版本tensorflow

white-the-Alan 2018-04-01 12:08 原文

一、安装anaconda 

1.去官网下载anaconda linux版本即可

 

选择合适的版本下载即可

2.安装Aanconda:

打开终端(Ctrl+Alt+t)进入到下载的目录一般在home 下的Downloads (或者进入到下载的文件夹右键打开open Terminal也可以)

执行命令bash Anaconda3-5.10-Linux-x86_64.sh 笔者是Anaconda3-5.10-Linux-x86_64版本的,这里是写你下载的版本型号,回车,一路yes即可

安装完成之后,打开新的Terminal终端,在终端中查看版本信息确认是否安装

输入conda-V

至此安装完成

如果报错,就配置一下anaconda 的环境变量
在终端输入sudo gedit /etc/profile,打开profile文件。

在文件末尾添加一行:export PATH=/home/用户名/anaconda3/bin:$PATH,保存    

重启Linux 不然找不到命令

再输入conda -V 验证即可

3.创建环境

conda create -n flapp python=3.6(当然可以安装任意python版本只需将3.6改掉即可)

4.激活环境

source activate flapp

二、tensorflow安装

激活环境后在命令行输入

1.使用pip安装cpu版本的tensorflow

 

pip install --upgrade \
https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.3.0-cp36-cp36m-linux_x86_64.whl

2.运行简短的tensorflow 程序
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session() print(sess.run(hello))

如果输出以下内容,则可以开始编写TensorFlow程序了:

Hello, TensorFlow!
三、tensorflow python包的URL
python2.7
cpu支持:
https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.3.0-cp27-none-linux_x86_64.whl
gpu 支持:
https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.3.0-cp27-none-linux_x86_64.whl

python3.4

仅CPU:

https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.3.0-cp34-cp34m-linux_x86_64.whl

GPU支持:

https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.3.0-cp34-cp34m-linux_x86_64.whl

Python 3.5

仅CPU:

https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.3.0-cp35-cp35m-linux_x86_64.whl

GPU支持:

https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.3.0-cp35-cp35m-linux_x86_64.whl

Python 3.6

仅CPU:

https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.3.0-cp36-cp36m-linux_x86_64.whl

GPU支持:

https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.3.0-cp36-cp36m-linux_x86_64.whl

 

 

推荐阅读