Ubuntu安装配置tensorflow

TensorFlow 可以在 Ubuntu 和 macOS 上基于 native pip、Anaconda、virtualenv 和 Docker 进行安装,对于 Windows 操作系统,可以使用 native pip 或 Anaconda。

Anaconda 适用于这三种操作系统,安装简单,在同一个系统上维护不同的项目环境也很方便,因此本教程将基于 Anaconda 安装 TensorFlow。

TensorFlow安装准备工作

TensorFlow 安装的前提是系统安装了 Python 2.5 或更高版本,教程中的例子是以 Python 3.5(Anaconda 3 版)为基础设计的。为了安装 TensorFlow,首先确保你已经安装了 Anaconda。可以从网址(https://www.continuum.io/downloads)中下载并安装适用于 Windows/macOS 或 Linux 的 Anaconda。

安装完成后,可以在窗口中使用以下命令进行安装验证:

conda –version安装了 Anaconda,下一步决定是否安装 TensorFlow CPU 版本或 GPU 版本。几乎所有计算机都支持 TensorFlow CPU 版本,而 GPU 版本则要求计算机有一个 CUDA compute capability 3.0 及以上的 NVDIA GPU 显卡(对于台式机而言最低配置为 NVDIA GTX 650)。 

CPU 与 GPU 的对比:中央处理器(CPU)由对顺序串行处理优化的内核(4~8个)组成。图形处理器(GPU)具有大规模并行架构,由数千个更小且更有效的核芯(大致以千计)组成,能够同时处理多个任务。对于 TensorFlow GPU 版本,需要先安装 CUDA toolkit 7.0 及以上版本、NVDIA【R】驱动程序和 cuDNN v3 或以上版本。Windows 系统还另外需要一些 DLL 文件,读者可以下载所需的 DLL 文件或安装 Visual Studio C++。

TensorFlow安装操作

在命令行中使用以下命令创建 conda 环境(如果使用 Windows,最好在命令行中以管理员身份执行):

conda create -n tensorflow python=3.5

安装命令:

pip install –ignore-installed –upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.1.0-cp35-cp35m-manylinux2010_x86_64.whl

安装版本地址按以下表格筛选

从 PyPI 中选择以下某个 TensorFlow 软件包进行安装:

  • tensorflow:支持 CPU 和 GPU 的最新稳定版(适用于 Ubuntu 和 Windows)。
  • tf-nightly:预览 build(不稳定)。Ubuntu 和 Windows 均包含 GPU 支持
  • tensorflow==1.15:TensorFlow 1.x 的最终版本。

软件包位置

有几个安装机制需要您提供 TensorFlow Python 软件包的网址。 您需要根据 Python 版本指定网址。

版本网址
Linux
Python 2.7(支持 GPU)https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.1.0-cp27-cp27mu-manylinux2010_x86_64.whl
Python 2.7(仅支持 CPU)https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.1.0-cp27-cp27mu-manylinux2010_x86_64.whl
Python 3.5(支持 GPU)https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.1.0-cp35-cp35m-manylinux2010_x86_64.whl
Python 3.5(仅支持 CPU)https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.1.0-cp35-cp35m-manylinux2010_x86_64.whl
Python 3.6(支持 GPU)https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.1.0-cp36-cp36m-manylinux2010_x86_64.whl
Python 3.6(仅支持 CPU)https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.1.0-cp36-cp36m-manylinux2010_x86_64.whl
Python 3.7(支持 GPU)https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.1.0-cp37-cp37m-manylinux2010_x86_64.whl
Python 3.7(仅支持 CPU)https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.1.0-cp37-cp37m-manylinux2010_x86_64.whl
macOS(仅支持 CPU)
Python 2.7https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.1.0-cp27-cp27m-macosx_10_9_x86_64.whl
Python 3.5https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.1.0-cp35-cp35m-macosx_10_6_intel.whl
Python 3.6https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.1.0-cp36-cp36m-macosx_10_9_x86_64.whl
Python 3.7https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.1.0-cp37-cp37m-macosx_10_9_x86_64.whl
Windows
Python 3.5(支持 GPU)https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-2.1.0-cp35-cp35m-win_amd64.whl
Python 3.5(仅支持 CPU)https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow_cpu-2.1.0-cp35-cp35m-win_amd64.whl
Python 3.6(支持 GPU)https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-2.1.0-cp36-cp36m-win_amd64.whl
Python 3.6(仅支持 CPU)https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow_cpu-2.1.0-cp36-cp36m-win_amd64.whl
Python 3.7(支持 GPU)https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-2.1.0-cp37-cp37m-win_amd64.whl
Python 3.7(仅支持 CPU)https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow_cpu-2.1.0-cp37-cp37m-win_amd64.whl
Raspberry PI(仅支持 CPU)
Python 3、Pi0 或 Pi1https://storage.googleapis.com/tensorflow/raspberrypi/tensorflow-2.1.0-cp35-none-linux_armv6l.whl
Python 3、Pi2 或 Pi3https://storage.googleapis.com/tensorflow/raspberrypi/tensorflow-2.1.0-cp35-none-linux_armv7l.whl

如若转载,请注明出处:https://www.ouq.net/ubuntu%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%aetensorflow.html

(0)
打赏 微信打赏,为服务器增加50M流量 微信打赏,为服务器增加50M流量 支付宝打赏,为服务器增加50M流量 支付宝打赏,为服务器增加50M流量
上一篇 03/12/2020 19:17
下一篇 03/15/2020

相关推荐

  • XlsxWriter:用Python创建操作Excel xlsx文件

    XlsxWriter 是一个 Python 模块,可用于将文本、数字、公式和超链接写入 Excel 2007+ XLSX 文件中的多个工作表。 它支持格式化等功能,包括: 100%…

    03/03/2022
    111
  • CRISPR 设计和Off Target预测:tefor

    1.在线网站 http://crispor.tefor.net/ 2.界面简洁,step1输入KO的序列,step2/3中选择相应的选项即可获得信息。  

    07/15/2021
    290
  • Mac常用快捷键

    Finder 快捷键 作用 备注 Command + ↑ 返回上一层 Command + ↓ 进入当前文件夹 Shift + Command + G 前往指定路径的文件夹 包括隐藏…

    Python 08/29/2021
    139
  • Cytoscape基因互作网络分析软件和教程

    Cytoscape是一个开放源代码软件平台,用于可视化分子相互作用网络和生物途径, 并将这些网络与注释,基因表达谱和其他状态数据整合在一起 。 尽管Cytoscape最初是为生物学…

    03/21/2020
    217
  • Linux操作系统:常用命令

    Linux系统的命令通常都是如下所示的格式: 命令名称 [命名参数] [命令对象] 获取登录信息 – w / who / last/ lastb。 [root ~]# …

    03/16/2022
    128