ubantu18.04的Anaconda安装tensorflow

一、Anaconda的安装

  1. 可去Anaconda官网下载,也可去在清华大学开源软件镜像站下载(推荐),我下载的是Anaconda3-2018.12-Linux-x86_64.sh这个版本。

  2. 在终端-下载中使用命令 sh Anaconda3-2018.12-Linux-x86_64.sh 进行安装。然后一路yes or enter 下去。

  3. 配置环境变量,在终端中输入

$ sudo gedit ~/.bashrc

  然后文件末尾输入 export PATH="home/ho/Anaconda3/bin:$PATH" ,保存退出,在终端输入 source ~/.bashrc。

  4. 在终端进入Python,见有Anaconda字样,即安装成功。

二、tensorflow安装

  1. 创建一个python3.6名为tensorflow的conda环境 

$ conda create -n tensorflow python=3.6

  第一次尝试,我出错了。报错信息为

  An HTTP error occurred when trying to retrieve this URL.
  HTTP errors are often intermittent, and a simple retry will get you on your way.

  解决方案:使用清华大学提供的镜像(下面的一二行),然后编辑主目录下.condarc配置文件,删除-default那一行。

  至此,再次使用命令conda create -n tensorflow python=3.6就没问题了

  2. 激活tensorflow

  见到上图字样,输入source activate tensorflow就激活啦

  3. 安装tensorflow

$ conda install tensorflow

  完毕!

(第一次写,先这样吧,本人小小小白一枚,请大佬们多多指教)

      

猜你喜欢

转载自www.cnblogs.com/harbin-ho/p/10654638.html