Linux 安装 luarocks(lua的模块管理工具)
来源:互联网 发布:如何设置数据库子符集 编辑:程序博客网 时间:2024/05/29 11:54
1、简介
该软件包可以安装和更新lua的第三方模块。
2、下载地址
请在 http://luarocks.org/releases/ 页面选择需要的软件包。
wget http://luarocks.org/releases/luarocks-2.1.0.tar.gz
3、安装
tar -zxvf luarocks-2.1.0.tar.gz
cd luarocks-2.1.0
./configure --prefix=/usr/local/luarocks
make build
make install
OK了,luarock的可执行文件被安装到了 /usr/local/luarocks/bin/luarocks.
4、使用(暂时把英文直接copy过来,有时间再翻译)
使用luarocks安装lua模块的示例:
luarocks install luasocket
luarocks install luasql-sqlite3
luarocks install lpeg
luarocks install lzlib
luarocks install luafilesystem
luarocks install luasec
luarocks install md5
luarocks install luacurl
luarocks install luasql-mysql MYSQL_INCDIR=/usr/include/mysql MYSQL_LIBDIR=/usr/lib64/mysql/ (mysql的各种路径自己locate去找吧 = = !)
luarocks install lua-cjson
1.模块安装后如果在程序require的时候提示找不到相应模块则可以在luarocks和lua之间做一个软链接:
例如安装完luasql-mysql之后可能在程序中require的时候会提示找不到模块,这时候我们可以:
cd /usr/local/lib/lua/5.1/
mkdir luasql
ln -s /usr/local/luarocks/lib/lua/5.1/luasql/mysql.so /usr/local/lib/lua/5.1/luasql/mysql.so
2.运行时提示attempt to index global 'luasql' (a nil value) 代码里面require "luasql.mysql"需要这样写
luasql = require "luasql.mysql"
Usage
- luarocks [--server=server | --only-server=server] [--tree=tree] [--only-sources=url] [--deps-mode=mode] [VAR=VALUE]...command [argument]
Variables from the "variables" table of the configuration file can be overriden with VAR=VALUE assignments.
--server=serverFetch rocks/rockspecs from this server (takes priority over config file)--only-server=serverFetch rocks/rockspecs from this server only (overrides any entries in the config file)--only-sources=urlRestrict downloads of sources to URLs starting with the given URL. For example, --only-sources=http://luarocks.org will allow LuaRocks to download sources only if the URL given in the rockspec starts with http://luarocks.org .--tree=treeWhich tree to operate on.--deps-mode=modeSelect dependencies mode:How to handle the list of rocks servers given in the rocks_servers array in theconfig file.
- one - Consider only the tree at the top of the list (possibly, the one given by the --tree flag, overriding all entries from rocks_trees), ignore all others
- all - Consider all trees: if a dependency is installed in any tree of the rocks_trees list, we have a positive match.
- order - Consider only trees starting from the "current" one in the order, where the "current" is either:
- the one at the bottom of the rocks_trees list,
- or one explicitly given with --tree
- or the "home" tree if --local was given or local_by_default=true is configured (usually at the top of the list)
Supported commands
buildBuild/compile and install a rock.downloadDownload a specific rock or rockspec file from a rocks server.helpHelp on commands.installInstall a rock.listLists currently installed rocks.makeCompile package in current directory using a rockspec and install it.packCreate a rock, packing sources or binaries.pathReturn the currently configured package path.removeUninstall a rock.searchQuery the LuaRocks repositories.showShows information about an installed rock.unpackUnpack the contents of a rock.
Overview of the difference between "make", "build", "install" and "pack"
luarocks install modulenamedownloads a binary .rock file and installs it to the local tree (falls back to "luarocks build modulename" behavior if a binary rock is not found)luarocks build modulenamedownloads a .src.rock or a rockspec and builds+installs it to the local tree.luarocks build modulename-1.0-1.linux-x86.rockextracts the rockspec from the rock and builds it as if the rockspec was passed in the command-line (i.e., redownloading sources and recompiling C modules if any).luarocks build modulename-1.0-1.rockspecbuilds+installs the rock using the given rockspec downloading the sourcesluarocks make modulename-1.0-1.rockspecbuilds+installs the rock using the rockspec using the contents of your current directory (kind of like the way make uses a Makefile) instead of downloading sourcesluarocks pack modulenamegrabs the rock from your local tree and packs it into a binary .rock fileluarocks pack modulename-1.0-1.rockspecdownloads the sources from the url and packs it into a .src.rock file
来源:http://www.linuxidc.com/Linux/2014-01/95501.htm
- Linux 安装 luarocks(lua的模块管理工具)
- lua包管理工具luarocks安装
- Lua 的模块安装和部署工具 - LuaRocks
- [Lua]插件管理工具LuaRocks
- Lua包管理工具Luarocks详解
- Lua包管理工具Luarocks介绍
- Lua包管理工具Luarocks详解
- ubuntu下安装lua和luarocks
- lua(1):lua,luarocks介绍及lua库安装
- 安装torch与luarocks的一些问题
- 源码安装luarocks
- 用proxychain解决luarocks install无法安装包的问题
- 在mac上安装Python下的模块管理工具pip
- 在mac上安装Python下的模块管理工具pip
- linux管理工具WDCP的安装教程
- 【Lua系列】linux下lua的安装
- Luarocks
- nginx安装lua模块
- 关于Tip of the Day
- 学以致用——ikb知识库英文词条词频分析-Part3-使用Excel制作高频词标签云(VBA)
- css_day01_对文本的设置
- Leetcode 261. Graph Valid Tree
- Python基础02 基本数据类型
- Linux 安装 luarocks(lua的模块管理工具)
- JMS规范
- bingo-培训——软件工程(套路)
- 进程间的通信之1-----管道
- Revit怎样给桥梁里加上预应力钢筋
- 最大似然估计算法
- Android 增强版百分比布局库 为了适配而扩展
- linux ceil函数
- 期望最大化(EM)算法