LoginSignup
4
8

More than 5 years have passed since last update.

TensorflowがWindowsのネイティブサポートをしたのでインストール

Last updated at Posted at 2016-12-03

公式サイトはこちら(英語)

引用する文章

このような形でページトップのリンクから引用していきます。

こちらの環境は、最新(AnniversaryUpdate済み)Windows10、64bitです。

前提

TensorFlow supports only 64-bit Python 3.5 on Windows.

Tensorflowは、windows上では64bitのPython3.5だけに対応しているみたいですね。

インストール

Pip installation on Windows

pipとは、Python3.5をインストールするとついてくるPythonのパッケージマネージャーみたいなツールみたいです。
それを使うと簡単にインストールができるそうです。

Python3.5(64bit)を入れる

Python3.5は、Python 3.5 from python.orgからダウンロード可能です。
私はFilesWindows x86-64 executable installerをダウンロードしてインストールしました。

インストール時に特に指定をしないと

C:\Users\ユーザ名\AppData\Local\Programs\Python\Python35\Scripts

ここにpipがインストールされると思います。
インストールされていない場合は、もう一度インストーラーを起動してpipをインストールしてください。

Scriptsディレクトリを環境変数Pathに登録しておくと、Tensorflowのインストールがしやすいでしょう。

Tensorflowを入れる

To install the CPU-only version of TensorFlow, enter the following command at a command prompt:

コマンド省略、公式ページを御覧ください

To install the GPU version of TensorFlow, enter the following command at a command prompt:

コマンド省略、公式ページを御覧ください

ここでは、CPUのみかGPUを使うかで2種類のコマンドが用意されています。
上がCPUのみ、下がGPUを使う場合になっています。

早速CPU用のコマンドを実行。

C:\>pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl
Collecting tensorflow==0.12.0rc0 from https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl
  Downloading https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl (12.2MB)
    100% |################################| 12.2MB 70kB/s
Collecting numpy>=1.11.0 (from tensorflow==0.12.0rc0)
  Downloading numpy-1.11.2-cp35-none-win_amd64.whl (7.6MB)
    100% |################################| 7.6MB 107kB/s
Collecting wheel>=0.26 (from tensorflow==0.12.0rc0)
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
    100% |################################| 71kB 1.7MB/s
Collecting protobuf==3.1.0 (from tensorflow==0.12.0rc0)
  Downloading protobuf-3.1.0-py2.py3-none-any.whl (339kB)
    100% |################################| 348kB 2.2MB/s
Collecting six>=1.10.0 (from tensorflow==0.12.0rc0)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting setuptools (from protobuf==3.1.0->tensorflow==0.12.0rc0)
  Downloading setuptools-30.0.0-py2.py3-none-any.whl (472kB)
    100% |################################| 481kB 589kB/s
Installing collected packages: numpy, wheel, six, setuptools, protobuf, tensorflow
  Found existing installation: setuptools 20.10.1
    Uninstalling setuptools-20.10.1:
      Successfully uninstalled setuptools-20.10.1
Successfully installed numpy-1.11.2 protobuf-3.1.0 setuptools-30.0.0 six-1.10.0 tensorflow-0.12.0rc0 wheel-0.29.0
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

下の2行くらいで、pipのバージョンが古いと怒られているようです。

指示されたコマンドを使ってpipを更新します。

C:\>python -m pip install --upgrade pip
Collecting pip
  Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 8.1.1
    Uninstalling pip-8.1.1:
      Successfully uninstalled pip-8.1.1
Successfully installed pip-9.0.1

Successfully installedと出てきたので多分できました。

それではもう一度Tensorflowを入れてみます。

C:\>pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl
Collecting tensorflow==0.12.0rc0 from https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl
  Using cached https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl
Requirement already up-to-date: numpy>=1.11.0 in c:\users\a1503\appdata\local\programs\python\python35\lib\site-packages (from tensorflow==0.12.0rc0)
Requirement already up-to-date: six>=1.10.0 in c:\users\a1503\appdata\local\programs\python\python35\lib\site-packages (from tensorflow==0.12.0rc0)
Requirement already up-to-date: wheel>=0.26 in c:\users\a1503\appdata\local\programs\python\python35\lib\site-packages (from tensorflow==0.12.0rc0)
Requirement already up-to-date: protobuf==3.1.0 in c:\users\a1503\appdata\local\programs\python\python35\lib\site-packages (from tensorflow==0.12.0rc0)
Requirement already up-to-date: setuptools in c:\users\a1503\appdata\local\programs\python\python35\lib\site-packages (from protobuf==3.1.0->tensorflow==0.12.0rc0)
Installing collected packages: tensorflow
  Found existing installation: tensorflow 0.12.0rc0
    Uninstalling tensorflow-0.12.0rc0:
      Successfully uninstalled tensorflow-0.12.0rc0
Successfully installed tensorflow-0.12.0rc0

Successfully installedと出ているので、きっと成功です。
だいぶ簡単にできました。

使ってみる→windowsにネイティブサポートしたTensorflowを動かす

4
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
8