$ curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash
$ git clone https://github.com/torch/distro.git ~/torch --recursive # install in your "home","/home/usrname", and you can change it if you want
$ cd ~/torch;
$ ./install.sh # and enter "yes" at the end to modify your bashrc
$ source ~/.bashrc
$ luarocks install cutorch
$ luarocks install cunn
当安装GPU支持时,可能出现如下错误:
Error: No results matching query were found.
使用源码安装,需要先安装cutorch,因为cunn的安装依赖于cutorch;
$ git clone git://github.com/torch/cutorch.git
$ luarocks install cutorch/rocks/cutorch-scm-1.rockspec
git clone https://github.com/torch/cunn
luarocks make cunn/rocks/cunn-scm-1.rockspec
通过上述安装方法,可以解决无法安装cutorch
和cunn
的情况;