天天看點

windows下完整安裝theano(安裝及配置),keras調用theano

雖然現在對于theano的使用不算多,但是需要的時候往往安裝出現各種問題,也踩了很多坑,是以想把成功的方法分享給大家,避免陷入困難,浪費大量時間。

參考部落格及論壇:

https://blog.csdn.net/linangfs/article/details/81366893

https://blog.csdn.net/qq_33626989/article/details/81811297

https://stackoverflow.com/questions/44103230/theano-attributeerror-module-theano-has-no-attribute-gof

環境:win7 64位,python3.6

1.建立環境,并切換到環境。

2.安裝mingw, libpython

conda install mingw libpython
           

3.安裝mkl , nose

conda install mkl
conda install nose
           

4.安裝theano

conda install theano pygpu
conda install mkl-service 
           

5.添加配置檔案 .theanorc.txt

位置:C:\Users\XXX(具體是自己的使用者名或Administrator)

**注意:**檔案名的前邊有一個點

在建立的配置檔案中添加如下内容

[blas]
ldflags=-lblas
           

6.測試

import theano
           

無任何報錯,通過運作即成功安裝。

使用時需要修改keras.json設為th,theano。import keras會提示後端為theano,無任何報錯即可正常使用。

注意:

numpy安裝1.13.1,不然會有gof有關的報錯。

下面是我所建環境的配置檔案,包括conda和pip的 ,對于keras,theano , tensorflow最好還是通過pip安裝。

連結: https://pan.baidu.com/s/1vNlJjSVGLLN3D6ihDXrbdw 提取碼: wxah

歡迎大家積極留言,把遇到的問題說出來,共同解決。