2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Linux に Anaconda で TensorFlow をインストールし Jupyter Notebook で使う簡単な方法

Last updated at Posted at 2019-02-07

Anaconda 公式ブログ(英語)に書かれていた方法に,一部,追記した内容となります.
ブログ記事が最近,削除されたようなので,備忘録として残しておきます.
もしかしたら問題があるのかもしれませんが,2019年 2月現在,最も簡単で確実な方法と思います.

環境

ホストマシンの OS: Mac OS X, Windows 7
VirtualBox: 6.0.4
Linux: CentOS 7.6.1810, Ubuntu 18.04.1 LTS
Anaconda Installer: Anaconda3-5.3.1-Linux-x86_64.sh
Python 3.7.0
conda 4.5.11

※ 最新の Anaconda3-2018.12-Linux-x86_64.sh でインストールすると,Jupyter Notebook のセルが動作しないようです.

概要

  1. TensorFlow 用の環境を作成
  2. その環境に Jupyter をインストール
  3. ベース環境に nb_conda をインストール
  4. ベース環境で Jupyter Notebook を起動
  5. ブラウザ上で .ipynb 新規作成時に Python[conda env:tensorflow_env] を選択

実際のコマンド

$ conda create -n tensorflow_env tensorflow
$ conda activate tensorflow_env
(tensorflow_env) $ conda install jupyter
(tensorflow_env) $ conda deactivate
(base) $ conda install nb_conda

tensorflow_env 環境は以下のディレクトリに保存されます.
anaconda3/envs/tensorflow_env

※ インストールされていないパッケージが多々あるため,その都度,インストールが必要になるのが不便です.

(base) $ jupyter notebook

ブラウザ上で

localhost:8888/tree
の Jupyter (Home) で
New -> Python[conda env:tensorflow_env]

動作確認

HelloTensorFlow.ipynb
import tensorflow as tf
print(tf.__version__)
2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?