torch 官网

torch:Torch website

安装步骤

Torch can be installed to your home folder in ~/torch by running these three commands:

# in a terminal, run the commands WITHOUT sudo
# installs the basic package dependencies that LuaJIT and Torch require.
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch
# installs LuaJIT, LuaRocks, and then uses LuaRocks (the lua package manager)
# to install core packages like torch, nn and paths, as well as a few other packages.
bash install-deps
./install.sh

[NOTE]


  • 在使用第一个命令克隆的时候会报以下类似的警告:

    Submodule 'pkg/sys' (https://github.com/torch/sys.git) registered for path 'pkg/sys'

    [处理办法]忽略就行..大概意思就是子模块将被下载后放在相应的位置处..


  • 在执行第三条命令之前需要修改 install-deps 文件

    1. Home -> Torch -> Open install-deps

    2. find the keyword python-software-properties and replace it with software-python-common, save and exit.

    3. install the software-python-common with the command

      sudo apt-get install software-properties-common
    4. run the command

      cd ~/torch; bash install-deps;

  • 执行以上命来之后,脚本后自动更新环境变量,你也可以手动进行更新:

    source ~/.bashrc

卸载Torch

If you ever need to uninstall torch, simply run the command:

rm -rf ~/torch

检验安装是否成功

Once installed you can run torch with the command th from you prompt!

这样你就可以在这个交互窗口内学习和使用Torch.


[补充] install torch with Lua 5.2 instead of LuaJIT

执行以下命令.

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

# clean old torch installation
./clean.sh
# optional clean command (for older torch versions) 对于老版本的torch,可选清除命来.
# curl -s https://raw.githubusercontent.com/torch/ezinstall/master/clean-old.sh | bash

# https://github.com/torch/distro : set env to use lua
TORCH_LUA_VERSION=LUA52 ./install.sh
# New packages can be installed using Luarocks from the command-line:

# run luarocks WITHOUT sudo
$ luarocks install image
$ luarocks list

02-14 04:46