您的位置:首页 > 其它

基于Anaconda的TensorFlow安装(Ubuntu 16.04 LTS)

2017-09-29 10:38 651 查看
一、安装Anaconda

  从Anaconda官网(https://www.anaconda.com/download)下载linux版本的安装文件(推荐Python2.7 version),在终端中进行安装。

  bash Anaconda2-4.4.0-Linux-x86_64.sh



二、建立一个tensorflow的运行环境

   
conda create –n tensorflow python=2.7 
三、在conda环境中安装tensorflow
    (1)激活环境
        source activate tensorflow
    (2)安装tensorflow
        pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl  
    (3)退出环境
        source deactivate

四、测试是否安装成功

    (1)激活tensorflow环境

       source activate tensorflow

    (2)激活Python环境

       python

    (3)测试代码

        import tensorflow as tf

        hello = tf.constant('Hello, TensorFlow!') 

        sess = tf.Session()

        sess.run(hello)

    (4)退出python环境(ctrl+d)

    (5)退出tensorflow环境

        source deactivate



五、Jupyter中使用TensorFlow
    (1)进入tensorFlow环境,安装ipython和jupyter
       
conda install ipython  
       
conda install jupyter
        conda  install  matplotlib
    (2)运行命令
       
ipython kernelspec install-self –user
    (3)进入Jupyter
        jupyter notebook
  


 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息