配置torch,luarocks 在linux下

参考官网:http://torch.ch/docs/getting-started.html#_

https://luarocks.org/

http://wanghaitao8118.blog.163.com/blog/static/139869772201522771241402/


在联网状态下

一、安装LuaJIT和Torch要求的基本依赖包

curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash

二、下载torch并安装

这个过程需要几分钟,安装完会提示是否把路径加入到PATH变量,选择yes

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

三、

cd ~/torch;

./install.sh(执行错误的话,也许权限不够,sudo)

四,利用luarocks安装一些其他的包

luarocks install image

我的会提示

Error: Your user does not have write permissions in /usr/local/lib/luarocks/rocks 
-- you may want to run as a privileged user or use your local tree with --local.

我认为是有些文件夹我没有权限访问,因为我们多个人共同用一台服务器。

这里用sudo也不行了,那就用sudo su 跳转到root下。如果这里还不行那就考虑自己重新装一下luarocks。


五、下载并安装luarocks(https://luarocks.org/)

 wget http://luarocks.org/releases/luarocks-2.2.2.tar.gz
$ tar zxpf luarocks-2.2.2.tar.gz
$ cd luarocks-2.2.2
$ ./configure --prefix=/usr/local/luarocks; sudo make bootstrap

这里也许会提示配置失败 需要lua-5.2

那么安装个lua

下载地址 http://www.lua.org/ftp/

wget http://www.lua.org/ftp/lua-5.2.4.tar.gz
tar -zxvf lua-5.2.4.tar.gz
make linux test
make install
之后重新
./configure --prefix=/usr/local/luarocks; sudo make bootstrap

好了,这样就可以用luarocks来安装额外的包了。


六、luarocks list可以看到自己安装了什么包

七、测试

$th


配置torch,luarocks 在linux下_第1张图片

就成功了。

在http://wanghaitao8118.blog.163.com/blog/static/139869772201522771241402/中还给了一些额外的测试。写的很好!


你可能感兴趣的:(torch)