トップ «前の日記(2017-12-14) 最新 次の日記(2017-12-17)» 編集

Cocoa練習帳

iOS/iPhone/iPad/watchOS/tvOS/MacOSX/Android プログラミング, Objective-C, Cocoa, Swiftなど

2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|09|10|11|12|
2024|01|02|

2017-12-15 [macOS] TensorFlowをインストールする

CoreMLではモデルは開発者で用意しないといけない。TensorFlowの利用を考えて、インストールしてみる。

公式サイトの情報によると、macOSでは以下の選択肢がある。

  • virtualenv
  • "native" pip
  • Docker
  • installing from sources
  • Anaconda

お勧めはvirtualenvということなので、素直に従ってみる。

virtualenvをインストールする。

$ sudo easy_install pip
$ pip install --upgrade virtualenv

あれ、二個目のコマンドでエラーになる。パーミッション関連なので、sudoつけてみた。

$ sudo pip install --upgrade virtualenv

成功した。

virtualenv 環境を作成する。標準のPythonは2.7.10なので、以下のコマンドとなる。

$ virtualenv --system-site-packages ~/tensorflow

次はアクティベート。bashなので、以下のコマンドとなる。

$ source ~/tensorflow/bin/activate
(targetDirectory) $

pip 8.1がインストールされていることを確認する。

$ easy_install -U pip

TensorFlowをインストール。

$ pip install --upgrade tensorflow

動作確認する。

$ python
Python 2.7.10 (default, Jul 15 2017, 17:16:57) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> # Python
... import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
2017-12-15 22:40:19.713684: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.2 AVX AVX2 FMA
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> 

成功したみたいだ。

_ 【Cocoa練習帳】

http://www.bitz.co.jp/weblog/
http://ameblo.jp/bitz/(ミラー・サイト)
Qiita

トップ «前の日記(2017-12-14) 最新 次の日記(2017-12-17)» 編集