安装torch与luarocks的一些问题

本文档详细介绍了Torch在Linux环境下的安装流程,包括使用Git克隆Torch发行版、依赖项安装、环境变量配置及LuaRocks的设置与测试。针对安装过程中可能遇到的权限问题提供了具体的解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1. Installing 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

  2. 安装luarocks

    sudo apt-get install luarocks

  3. 测试:

    luarocks install image
    luarocks list

  4. 执行 $ 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.

  5. 解决办法: install torch with Lua 5.2 instead of LuaJIT, simply run:

    # clean old torch installation
    cd ~torch
    ./clean.sh
    TORCH_LUA_VERSION=LUA52 ./install.sh

    程序执行到最后,会询问:

    Do you want to automatically prepend the Torch install location
    to PATH and LD_LIBRARY_PATH in your /home/hri/.bashrc? (yes/no)
    [yes] >>>

    输入:

    yes

    这时候,打开~/.bashrc,

    sudo gedit ~/.bashrc

    在末尾会见到: . /home/hri/torch/install/bin/torch-activate
    其中/home/hri/torch/是torch安装的路径, 关闭./bashrc文件,执行如下命令:

    source ~/.bashrc
    bash

  6. 再次执行 步骤3, 成功,执行

    th

    将出现Getting started with Torch最后的结果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值