anaconda + tensorflow +ubuntu

来源:互联网 发布:海康云台控制键盘网络 编辑:程序博客网 时间:2024/06/02 04:15

ubuntu 16.04 LTS

CPU


一、安装anaconda

tensorflow是基于Python脚本语言的,因此需要安装python, 当然还需要安装numpy、scipy、six、matplotlib等几十个扩展包。如果一个个安装,装到啥时候去?(我曾经光安装scipy就装了一天。。。)

不过现在有了集成环境anaconda,安装就方便了。python的大部分扩展包, 都集成在anaconda里面了,因此只需要装这一个东西就行了。

先到https://www.continuum.io/downloads 下载anaconda, 现在的版本有python2.7版本和python3.5版本,下载好对应版本、对应系统的anaconda,它实际上是一个sh脚本文件,大约300M-400M左右。

$ bash Anaconda3-4.4.0-Linux-x86_64.sh

if finish install,please close terminal.


二、安装tensorflow

先在终端执行:

anaconda search -t conda tensorflow

搜索一下有哪些tensorflow安装包,通过查看版本,选择最高的版本安装。

Using Anaconda API: https://api.anaconda.org
Run 'anaconda show <USER/PACKAGE>' to get more details:
Packages:
     Name                      |  Version | Package Types   | Platforms      
     ------------------------- |   ------ | --------------- | ---------------
     HCC/tensorflow            |    1.0.0 | conda           | linux-64       
     HCC/tensorflow-cpucompat  |    1.0.0 | conda           | linux-64       
     HCC/tensorflow-fma        |    1.0.0 | conda           | linux-64       
     SentientPrime/tensorflow  |    0.6.0 | conda           | osx-64         
                                          : TensorFlow helps the tensors flow
     acellera/tensorflow-cuda  |   0.12.1 | conda           | linux-64       
     anaconda/tensorflow       |    1.1.0 | conda           | linux-ppc64le, linux-64, osx-64, win-64
     anaconda/tensorflow-gpu   |    1.1.0 | conda           | linux-ppc64le, linux-64
     conda-forge/r-tensorflow  |      0.7 | conda           | linux-64, osx-64, win-64
     conda-forge/tensorflow    |    1.1.0 | conda           | linux-64, win-64, osx-64
                                          : TensorFlow helps the tensors flow
     creditx/tensorflow        |    0.9.0 | conda           | linux-64       
                                          : TensorFlow helps the tensors flow
     derickl/tensorflow        |    1.1.0 | conda           | osx-64         
     dhirschfeld/tensorflow    |    1.2.0 | conda           | win-64         
                                          : Computation using data flow graphs for scalable machine learning
     dseuss/tensorflow         |          | conda           | osx-64         
     guyanhua/tensorflow       |    1.0.0 | conda           | linux-64       
     hajapy/tensorflow         |    1.2.0 | conda           | linux-64, osx-64
                                          : TensorFlow helps the tensors flow
     ijstokes/tensorflow       | 2017.03.03.1349 | conda, ipynb    | linux-64       
     jjh_cio_testing/tensorflow |    1.2.0 | conda           | linux-64       
                                          : TensorFlow is a machine learning library
     jjh_cio_testing/tensorflow-gpu |          | conda           | linux-64       
     jjh_ppc64le/tensorflow    |          | conda           | linux-ppc64le  
     jjh_ppc64le/tensorflow-gpu |          | conda           | linux-ppc64le  
     jjhelmus/tensorflow       | 0.12.0rc0 | conda, pypi     | linux-64, osx-64
                                          : TensorFlow helps the tensors flow
     jjhelmus/tensorflow-gpu   |    1.0.1 | conda           | linux-64       
     kevin-keraudren/tensorflow |    0.9.0 | conda           | linux-64       
     lcls-rhel7/tensorflow     |    1.1.0 | conda           | linux-64       
     marta-sd/tensorflow       |    1.0.1 | conda           | linux-64       
                                          : TensorFlow helps the tensors flow
     memex/tensorflow          |    0.5.0 | conda           | linux-64, osx-64
                                          : TensorFlow helps the tensors flow
     mhworth/tensorflow        |    0.7.1 | conda           | osx-64         
                                          : TensorFlow helps the tensors flow
     miovision/tensorflow      | 0.10.0.gpu | conda           | linux-64, osx-64
     msarahan/tensorflow       | 1.0.0rc2 | conda           | linux-64       
     mutirri/tensorflow        | 0.10.0rc0 | conda           | linux-64       
     mwojcikowski/tensorflow   |    1.0.1 | conda           | linux-64       
     nehaljwani/tensorflow     |    1.1.0 | conda           | win-64, osx-64
                                          : TensorFlow is a machine learning library
     rdonnelly/tensorflow      |    0.9.0 | conda           | linux-64       
     rdonnellyr/r-tensorflow   |    0.4.0 | conda           | osx-64         
     test_org_002/tensorflow   | 0.10.0rc0 | conda           |                
Found 35 packages


因此,执行下面代码来查看详细信息:

anaconda show jjh_cio_testing/tensorflow

它就会告诉你,怎么来安装这个包,在终端执行:

To install this package with conda run:
     conda install --channel https://conda.anaconda.org/jjh_cio_testing tensorflow


然后输入"y",进行安装。


三、调试

安装成功与否,我们可以测试一下。

在终端输入python,进入python编译环境,然后输入:

import tensorflow as tf

引包tensorflow包,如果没有报错,则安装成功,否则就有问题。

然后可以输入

tf.__version__tf.__path__

查看tensorflow的安装版本和安装路径(左右各两根下横线)。


原创粉丝点击