anaconda中如何安裝keras?


和pip有仇嗎?

pip install keras


還可以將keras包下載下來,下載地址:fchollet/keras

現在版本已經更新為 2.0.2

解壓到cmd所在的文件夾下,在cmd中輸入即可

python setup.py install

——————————————————————————————————

你可根據提示輸入,但是會發現還是不會安裝。。。。
我是這麼安裝成功的:

conda install -c conda-forge keras=1.0.7

另外,這裡,給你一個很好的連接,中文的。
Keras安裝和配置指南(Windows)
這裡面講的很詳細
在windows環境下安裝Keras,按照步驟來就行了。

還有一個方法可以作為參考(這是我摘來的)

  • Install TDM GCC x64.
  • Install Anaconda x64.
  • Open the Anaconda prompt
  • Run conda update conda
  • Run conda update --all
  • Run conda install mingw libpython
  • Install the latest version of Theano, pip install git+git://http://github.com/Theano/Theano.git
  • Run pip install git+git://http://github.com/fchollet/keras.git


總算一股腦安裝好了theano、keras,作為新手踩坑有點多。

我的情況:已有python2.7.12用過一段時間,win7,之前沒用過anaconda。

在發現anaconda本來也會附帶再安裝一個python後,遇到了各種問題,兩個python版本不兼容,打開python閃退等等。

最終整合網上各路說法,我的解決方案:

1.備份好原來的python一些文件後,將原python2.7.12徹底卸載乾淨

2.我選擇安裝了Anaconda2.4.3.0,64位

3.用conda安裝mingw和libpython這倆貨,並設置mingw環境變數,下載太慢就用清華的鏡像

4.用pip安裝theano

5.配置路徑文件,就是在用戶文件夾下加個" .theanorc.txt ",具體參考下面兩篇博文的做法:

手把手教你搭建深度學習平台--避坑安裝theano+CUDA - Mario-Chao - 博客園theano和keras安裝 - Single、Dog - 博客園

6.至此已經可以在新的python2.7.13中import theano了,但theano.test()還是會有錯,說缺少"nose_parameterized"這個模塊,於是繼續用pip安裝之

7. 繼續pip安裝keras

8.在用戶文件夾的.keras子文件夾下找到keras.json,然後記事本編輯改"tensorflow"為"theano"

9.至此成功安裝完成keras


最直接的如下:

conda install --channel https://conda.anaconda.org/conda-forge keras

參考github討論帖:How do I install Keras and Theano in Anaconda Python on Windows?


這個世界上有種東西叫anaconda navigator


ubuntu下的anaconda, 直接在Environments下查看Not installed,就會顯示灰色的keras,表示未安裝的package,選中點擊Apply,幾分鐘輕鬆搞定,同樣也可以用此方法安裝tensorflow.


算了,還是來答一簡單的(mac平台一定適用,其他的沒有試過,想必其他的平台也一樣)

看圖

1.依次點擊 Environments - root -open Terinal

2 彈出如下終端,輸入 pip install keras

查看,這時候到installed中搜索,發現在已經安裝的包中就有了keras


裝個ubuntu吧,用anaconda安裝就沒什麼問題


推薦閱讀:

Python 中 「is」 和 「==」 的問題?
wxPython什麼時候可以支持Python3.5?
python中字元串 s[ : -1]是什麼意思?
為什麼用pycharm在同目錄下import,pycharm會報錯,但是實際可以運行?
不同的語言中多進程和多線程具體的原理是什麼?

TAG:Python | Python庫 | Python模塊安裝 | Anaconda |