Ubuntu Anaconda tensorflow install

本文为Ubuntu系统Anaconda3-5.2.0 Python3.6.5的tensorflow1.12.0安装教程

指定版本安装

pip安装

pip install --upgrade pip

Then

python -m pip install tensorflow-cpu==2.3.0 -i https://pypi.douban.com/simple/

在这里插入图片描述
结果
在这里插入图片描述

conda 安装

首先查看python版本

python --version

搭建tensorflow环境

conda create -n tensorflow python=3.6.5

查看新建的环境

conda env list

在这里插入图片描述
激活新建的环境

source activate tensorflow

然后,选择pip或者conda安装tensorflow, 依据操作系统,Python版本,CPU版本还是CPU+GPU版本,选择合适的语句(下面的网站很慢,推荐国内镜像)

Ubuntu/Linux 64-bit, CPU only, Python 2.7
(tensorflow1)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl
 
Ubuntu/Linux 64-bit, GPU enabled, Python 2.7
Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl
 
Mac OS X, CPU only, Python 2.7:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.10.0-py2-none-any.whl
 
Mac OS X, GPU enabled, Python 2.7:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow-0.10.0-py2-none-any.whl
 
Ubuntu/Linux 64-bit, CPU only, Python 3.4
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp34-cp34m-linux_x86_64.whl
 
Ubuntu/Linux 64-bit, GPU enabled, Python 3.4
Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp34-cp34m-linux_x86_64.whl
 
Ubuntu/Linux 64-bit, CPU only, Python 3.5
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp35-cp35m-linux_x86_64.whl
 
Ubuntu/Linux 64-bit, GPU enabled, Python 3.5
Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp35-cp35m-linux_x86_64.whl
 
Mac OS X, CPU only, Python 3.4 or 3.5:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.10.0-py3-none-any.whl
 
Mac OS X, GPU enabled, Python 3.4 or 3.5:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow-0.10.0-py3-none-any.whl

或者选择下面的代码

python -m pip install --upgrade wheel-URL

pick wheel-URL from below:

For Windows:

Python 3.6 CPU-only >> https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.12.0-cp36-cp36m-win_amd64.whl

Python 3.6 GPU support >> https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.12.0-cp36-cp36m-win_amd64.whl

For Linux:

Python 2.7 CPU-only >> https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.12.0-cp27-none-linux_x86_64.whl

Python 2.7 GPU support >> https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.12.0-cp27-none-linux_x86_64.whl

Python 3.6 CPU-only >> https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.12.0-cp36-cp36m-linux_x86_64.whl

Python 3.6 GPU support >> https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.12.0-cp36-cp36m-linux_x86_64.whl

macOS (CPU-only)

Python 2.7 >> https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py2-none-any.whl

Python 3.4, 3.5, 3.6 >> https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl

本次输入代码

export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.12.0-cp36-cp36m-linux_x86_64.whl

在这里插入图片描述
不输入上面这行无法使用pip3
然后输入

Python 2
(tensorflow)$ pip install --ignore-installed --upgrade $TF_BINARY_URL
 
Python 3
(tensorflow)$ pip3 install --ignore-installed --upgrade $TF_BINARY_URL

在这里插入图片描述
会因为网络原因报错很正常,重新输入指令即可
在这里插入图片描述
通过以下指令查看是否成功安装,下图最后一行

conda list

在这里插入图片描述
检测
在这里插入图片描述
在这里插入图片描述

在本次安装中spyder界面无法打开,终端输入:

pip install spyder==*

查看支持的版本
在这里插入图片描述
spyder 4.0.0后面对应的应该是python3.7
选择3.3.6

pip install spyder==* -i https://pypi.douban.com/simple/

结果
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值