利用快捷键Ctrl+Alt+T打开Ubuntu终端
第一步:
获取安装LuauJIT(C语言编写的Lua的解释器)和Torch所必需的依赖包。
代码如下:
1 git clone https://github.com/torch/distro.git ~/torch --recursive
如果提示git还未安装,在终端输入命令:
sudo apt-get install git
安装git
漫长的等待中。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
第二步:
刚才默认将依赖包下载在当前路径下的torch文件夹,进入torch文件夹,打开并执行install-deps中的命令。
代码如下:
cd ~/torch bash install-deps
又得等待好久,可以去喝杯咖啡~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
第三步:
执行install.sh文件
输入命令:
./install.sh
至此,安装torch需要的依赖已经搞定!!!!!!!!!!!!!!!!!!!!!!!!
第四步:
将路径添加到PATH变量中。
source ~/.bashrc source ~/.zshrc
使用上面两个命令中任意一个即可。 实际中使用的是第一个。
第五步:
检测安装是否成功。在终端输入th命令,若出现下图,表明安装成功。
附加:
利用粗暴删除来卸载torch:
rm -rf ~/torch
其实就是直接删除文件夹。
哒哒!至此Torch7全部安装完成。
××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××8
×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
2
1、torch的安装
具体可以参考 http://torch.ch/docs/getting-started.html
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; bash install-deps;
./install.sh
安装完了需要刷新环境变量配置
source ~/.bashrc
添加环境变量,在终端输入:
vi /etc/profile
进入文件后,在最后添加如下命令:
PATH=~/torch/install/bin:$PATH
直接在命令行中输入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>
2、安装相关开发依赖包
torch使用luarocks来安装相关的依赖开发包
luarocks install image
luarocks install optim
luarocks install itorch
luarocks install gnuplot
执行下面命令可以查看所以安装的依赖包
luarocks list
3、itorch的安装
在上面我们已经安装了itorch对应的包,但是还必须要有ipython才可以。
输入如下命令安装ipython
pip install ipython
pip install "ipython[notebook]"
最后命令行执行下面命令检验ipython是否安装成功
ipython notebook
运行之后会出现如下界面:
命令行输入下面命令就会进入itorch 的网页可视化界面
itorch notebook
在这个可视化界面我们就可以像在命令行里面一样,进行torch的相关命令操作
例如:
对于iTorch具体可以参考
https://github.com/facebook/iTorch
4、使用torch工具开发的相关深度学习项目
https://github.com/nagadomi/waifu2x
https://github.com/jcjohnson/neural-style
https://github.com/karpathy/neuraltalk2
https://github.com/karpathy/char-rnn
6、有关torch的相关学习资料
https://www.julyedu.com/video/play/18/130
https://github.com/torch/torch7
https://github.com/torch/torch7/wiki/Cheatsheet
(torch安装教程)