系統:windows 8.1
python環境:anaconda2
安裝時注意:
1、選擇為當前使用者安裝還是所有使用者安裝時使用預設選項;
2、勾選加入環境變數。
二、安裝mingw和libpython
1、執行完第一步後,開啟windows命令列,輸入命令:
>conda list
可以看到anaconda包含的庫,裡面沒有mingw、libpython、theano(linux版本的anaconda是包含theano庫的)
2、安裝mingw和libpython
>conda config --add channels
>conda config --set show_channel_urls yes
然後開始安裝:
可以看到網速很快,因為用的是清華的軟體倉庫源
>gcc -v
會顯示gcc版本等資訊
三、安裝theano
>pip install theano
四、最後的配置
在home資料夾(c:/user/)下新建乙個文字文件,取名為.theanorc.txt,並在裡面輸入如圖所示內容
上圖紅框裡的就是下圖中的mingw的路徑,要根據實際情況自己修改
五、驗證theano
這時所有工作已經完成了,驗證一下theano是否能正常工作和編譯c程式;新建乙個python檔案,輸入以下**:
import numpy as np
import time
import theano
a = np.random.rand(1000,10000).astype(theano.config.floatx)
b = np.random.rand(10000,1000).astype(theano.config.floatx)
np_start = time.time()
ab = a.dot(b)
np_end = time.time()
x,y = theano.tensor.matrices('xy')
mf = theano.function([x,y],x.dot(y))
t_start = time.time()
tab = mf(a,b)
t_end = time.time()
print("np time: %f[s], theano time: %f[s] (times should be close when run on cpu!)" %(
np_end-np_start, t_end-t_start))
print("result difference: %f" % (np.abs(ab-tab).max(), ))
正常情況,輸出結果如下(numpy和theano執行時間差不多,都是呼叫相同模組來做矩陣乘法):
Windows系統下恢復Ubuntu系統開機引導項
在重灌或修復windows系統後,開機啟動介面中的ubuntu系統引導項不見了,直接進入windows系統。下文將具體介紹如何恢復ubuntu系統開機引導項。1.準備一張ubuntu系統安裝盤 2.將ubuntu系統安裝盤插入光碟機,重啟計算機,進入bios,將開機啟動設定為光碟機 cd rom 啟...
windows系統下安裝nginx
mainline version 主線版本 stable version 穩定版本 legacy versions 歷史版本。一般生產用穩定版本,本文使用主線版本。2 啟動 注意不要直接雙擊nginx.exe,這樣會導致修改配置後重啟 停止nginx無效,需要手動關閉任務管理器內的所有nginx程序...
Windows系統下配置Leela Zero
眾所周知,l eela zero是比利時程式設計師gian carlo pascutto gcp 參照deepmind最新 在github上面開展的的一款開源圍棋專案,專案為分布式,依靠志願者提供算力。不借助任何人類知識,完全從零開始,致力於復現alphagozero 1 眾多棋友都很好奇,究竟如何...