在Ubuntu14.04安裝torch7筆記

利用快捷鍵Ctrl+Alt+T打開ubuntu終端。

第一步:
獲取安裝LuaJIT(C語言編寫的Lua的解釋器)和Torch所必需的依賴包。代碼如下:

git clone https://github.com/torch/distro.git ~/torch --recursive

如果說git還未安裝,在終端輸入命令: apt-get install git 安裝git

第二步:
由於默認將依賴包下載在當前路徑下的torch文件下,進入torch文件夾,打開並執行install-deps中的命令。代碼如下:

cd ~/torch;
bash install-deps;

注意:在執行這一步如果遇到類似這樣一個問題:

unity-control-center : 依賴: libcheese-gtk23 (>= 3.4.0) 但是它將不會被安裝
                       依賴: libcheese7 (>= 3.0.1) 但是它將不會被安裝
E: 錯誤,pkgProblemResolver::Resolve 發生故障,這可能是有軟件包被要求保持現狀的緣故。

解決方案:

先安裝一個aptitude, 即在終端輸入:

sudo apt-get install aptitude

安裝完之後,使用此工具安裝qt-sdk可用。即在終端輸入:

sudo aptitude install qt-sdk

隨後再執行bash install-deps;

第三步:
執行install.sh文件

./install.sh

第四步:
將路徑手動添加到PATH變量中:

source ~/.bashrc
source ~/.zshrc

使用上面兩個命令中任意一個即可。隨後:

source ~/.profile

第五步:檢測安裝是否成功。在終端輸入th命令,若出現下圖,表明安裝成功。

$ th

  ______             __   |  Torch7                                   
 /_  __/__  ________/ /   |  Scientific computing for Lua.         
  / / / _ \/ __/ __/ _ \  |                                           
 /_/  \___/_/  \__/_//_/  |  https://github.com/torch   
                          |  http://torch.ch            

th> torch.Tensor{1,2,3}
 1
 2
 3
[torch.DoubleTensor of dimension 3]

th>

附加:
利用粗暴刪除來卸載torch:

rm -rf ~/torch

參考torch官網:

“>http://torch.ch/docs/getting-started.html#

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章