LoginSignup
6
5

More than 5 years have passed since last update.

Python初心者 Anaconda Navigator / Jupyter notebookでKeras, Tensorflow 実装

Last updated at Posted at 2019-01-08

Python初心者がAnacondaの環境でkeras, Tesorflowを使えるようにしてみた。
その過程で、下記事象が発生。
・Python 3.7 tensorflow インストールできない
・Python 3.7 keras インストールできない
失敗も含めて備忘として残したいと思う。

環境
OS: win 10
Anaconda Navigator version: 1.9.6

前提
・2019年1月現在、Python 3.7でkerasとtensorflowをインストール出来ない
jupyter notebook上で!pip installした際のエラーメッセージ
!pip install -U tensorflow==1.6.0
⇒Could not find a version that satisfies the requirement tensorflow==1.6.0 (from versions: )
No matching distribution found for tensorflow==1.6.0
!pip install -U keras==2.0.0
⇒Could not find a version that satisfies the requirement tensorflow (from keras==2.0) (from versions: )
No matching distribution found for tensorflow (from keras==2.0)

・もともとAnacondaで入れていたのは、Python3.7なので、Keras, Tensorflowを入れる為にはPython 3.6にダウングレードする必要があった。
・Anacondaの環境ではbase(root)のみを使っていた(Anaconda NavigatorのEnviromentsで確認できる。Anacondaのデフォルトの環境)

失敗
・Python3.7が入っている環境(base(root))で、Anaconda Prompt上でConda install Python = 3.6.6 でPython3.6にダウングレードしたら、keras, tensorflowはインストールできたが、どうやらライブラリのパスがおかしくなったようで、matplot.pyplotやpandasのライブラリをインポートしようとすると、インポートエラーになる

対処とインストール
・今さらであるが、Anacondaで開発環境を別々に持つ事が可能なため、今回の場合base(root)とは別に、keras, tensorflowを導入する為の環境を別途準備。こちらではPython 3.6にして、必要に応じてこちらの環境で別途ライブラリーをインストールしている
1.PNG
・上記までできていればAnaconda NavigatorのHome>Applications on のメニューでPython3.6の環境(上の画像のKeras_tensorflow)を選んで、jupyter notebookを立ち上げ、下記のようにすればインストールできる(個人的な都合でtensorflow, kerasのバージョンを指定している)
!pip install -U tensorflow==1.6.0
!pip install -U keras==2.0.0
2.PNG
1.PNG

6
5
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
6
5