官方安装网站:http://torch.ch/docs/getting-started.html
我的安装命令
1、在终端输入:
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; bash install-deps;
./install.sh
等待一小时左右,取决于网速。
2、然后输入
source ~/.profile
注意:如果此时提示
No such file or directory
则在同torch文件夹的目录(我的torch文件夹在/User/myusername/torch, myusername是你的用户名),所以应该在/User/myusername/目录下输入:
$touch .profile
$vim .profile #打开文件进行编辑
在.profile添加. ~/torch/install/bin/torch-activate然后保存。
cd /User/myusername/torch
$source ~/.profile
没报错就安装成功
3、输入
$ th
______ __ | Torch7
/_ __/__ ________/ / | Scientific computing for Lua.
/ / / _ \/ __/ __/ _ \ | Type ? for help
/_/ \___/_/ \__/_//_/ | https://github.com/torch
| http://torch.ch
th>
要退出输入os.exit()
或者ctrl+两次C
4、torch和lua安装完毕后,可以用luarocks安装其它包
luarocks install image
luarocks list
$ luarocks install nngraph $ luarocks install optim $ luarocks install nn