安装torch与luarocks的一些问题

  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最后的结果

npm 是一个包管理器,主要用于 Node.js 应用程序的依赖关系管理。而 Torch 是一个基于 Lua 的科学计算框架,它提供了丰富的工具和库来支持机器学习和数据分析等任务。 由于 Torch 是基于 Lua 的,因此它不能直接通过 npm 安装。如果你想使用 Torch,需要先安装 Lua 环境以及 Torch 库。 以下是在 Linux 或 macOS 上安装 Torch 的步骤: 1. 安装 LuaLuaRocks Lua 是一种轻量级脚本语言,Torch 是基于 Lua 的,因此需要先安装 LuaLuaRocks 是一个用于管理 Lua 模块的软件包管理器。 在 Ubuntu 上可以使用以下命令安装: ``` sudo apt-get install lua5.1 liblua5.1-dev lua-lgi sudo apt-get install luarocks ``` 在 macOS 上可以使用 Homebrew 安装: ``` brew install lua brew install luarocks ``` 2. 安装 Torch 安装 Torch 可以使用以下命令: ``` git clone https://github.com/torch/distro.git ~/torch --recursive cd ~/torch; bash install-deps ./install.sh ``` 这个过程可能会比较耗时,请耐心等待。 3. 配置环境变量 安装完成后,需要将 Torch 的可执行文件路径添加到环境变量中。在 Linux 或 macOS 中,可以将以下命令添加到 `~/.bashrc` 或 `~/.bash_profile` 文件中: ``` export PATH=$HOME/torch/install/bin:$PATH ``` 4. 验证安装 运行以下命令来验证 Torch 是否安装成功: ``` th ``` 这个命令将启动 Torch 的 REPL(交互式解释器),如果没有出现错误信息,则说明安装成功。 如果你在 Windows 上使用 Torch,则可以通过官方提供的安装程序来安装。详细的安装步骤请参考 Torch 的官方文档:https://torch.ch/docs/getting-started.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值