在ubuntu16.04上安装tensorflow

TensorFlow官网

https://tensorflow.google.cn/

激活 conda 环境

source activate tensorflow

打开anaconda图形化界面

anaconda-navigator

退出vim编辑器

按键盘左上角的”ESC”,左下角的插入状态不见了,然后这时,我们输入“冒号”,即”:”(不需双引号),在下方会出现冒号,等待输入命令:

W:write,写入
Q:quit,退出
再回车,就保存退出了

ubuntu16.04登录后黑屏再次回到登录页面

方案:卸载NVIDIA

操作步骤:在登录页面按住ctrl+alt+F1进入如下页面

输入:root

输入root用户密码

输入:sudo apt-get –purge autoremove nvidia-*

在 conda 环境中安装 TensorFlow

(tensorflow) zxy@zxy-virtual-machine:~$ anaconda search -t conda tensorflow##查询所有版本信息,一定要看清是否适用(Buids)。

pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp27-none-linux_x86_64.whl

https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.1.0-cp27-none-linux_x86_64.whl

Using Anaconda API: https://api.anaconda.org

Packages:

Name | Version | Package Types | Platforms | Builds

————————- | —— | ————— | ————— | ———-

jjh_cio_testing/tensorflow-gpu-haswell-base | | conda | linux-64 | py36h9b5fe53_1, py27h9b5fe53_1

: TensorFlow is a machine learning library, base GPU package, tensorflow only.

jjh_cio_testing/tensorflow-haswell-base | | conda | linux-64 | py27h285635a_2, py36h285635a_2

: TensorFlow is a machine learning library, base package contains only tensorflow.

jjh_cio_testing/tensorflow-ivybridge-base | | conda | linux-64 | py27hcd4ac6e_2, py36hcd4ac6e_2

xxbandy123/tensorflow | 1.6.0 | conda | linux-64 | py27_cuda8.0_cudnn6.0h05b7654_0, py27_none_cuda8.0_cudnn6.0h6604e9d_0, py27_cuda8.0_cudnn6.0h2a7e788_0

Found 98 packages

Run ‘anaconda show <USER/PACKAGE>’ to get installation details

anaconda show sdvillal/tensorflow

(tensorflow) zxy@zxy-virtual-machine:~$ anaconda show sdvillal/tensorflow##查看某一版本信息,根据提示命令安装

Using Anaconda API: https://api.anaconda.org

Name: tensorflow

Summary: TensorFlow is a machine learning library

Access: public

Package Types: conda

Versions:

+ 1.3.0

To install this package with conda run:

conda install –channel https://conda.anaconda.org/sdvillal tensorflow##安装命令

conda uninstall –channel https://conda.anaconda.org/sdvillal tensorflow##卸载命令

Jupyter notebook引入tensorflow报错:

需要在conda环境中安装ipython和jupyter

(tensorflow) zxy@zxy-virtual-machine:~$ conda install ipython

(tensorflow) zxy@zxy-virtual-machine:~$ conda install jupyter

卸载已安装的tensorflow

zxy@zxy-virtual-machine:~$ source activate tensorflow

(tensorflow) zxy@zxy-virtual-machine:~$ pip show tensorflow

Name: tensorflow

Version: 1.3.0

Summary: TensorFlow helps the tensors flow

Home-page: http://tensorflow.org/

Author: Google Inc.

Author-email: opensource@google.com

License: Apache 2.0

Location: /home/zxy/anaconda2/envs/tensorflow/lib/python2.7/site-packages

Requires: backports.weakref, wheel, mock, tensorflow-tensorboard, numpy, protobuf, six

Required-by:

You are using pip version 10.0.1, however version 18.0 is available.

You should consider upgrading via the ‘pip install –upgrade pip’ command.

(tensorflow) zxy@zxy-virtual-machine:~$ sudo pip uninstall protobuf

sudo: pip:找不到命令

(tensorflow) zxy@zxy-virtual-machine:~$ pip uninstall tensorflow

Uninstalling tensorflow-1.3.0:

Would remove:

/home/zxy/anaconda2/envs/tensorflow/bin/saved_model_cli

/home/zxy/anaconda2/envs/tensorflow/bin/tensorboard

/home/zxy/anaconda2/envs/tensorflow/lib/python2.7/site-packages/external/*

/home/zxy/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow-1.3.0.dist-info/*

/home/zxy/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/*

Proceed (y/n)? y

Successfully uninstalled tensorflow-1.3.0

You are using pip version 10.0.1, however version 18.0 is available.

You should consider upgrading via the ‘pip install –upgrade pip’ command.

    原文作者:嗯对就是那个胖子
    原文地址: https://zhuanlan.zhihu.com/p/43447605
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞