lua安装教程 linux,Linux 安装 luarocks(lua的模块管理工具)
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=server
Fetch rocks/rockspecs from this server (takes priority over config file)
--only-server=server
Fetch rocks/rockspecs from this server only (overrides any entries in the config file)
--only-sources=url
Restrict 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=tree
Which tree to operate on.
--deps-mode=mode
Select 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
Build/compile and install a rock.
Download a specific rock or rockspec file from a rocks server.
Help on commands.
Install a rock.
Lists currently installed rocks.
Compile package in current directory using a rockspec and install it.
Create a rock, packing sources or binaries.
Return the currently configured package path.
Uninstall a rock.
Query the LuaRocks repositories.
Shows information about an installed rock.
Unpack the contents of a rock.
Overview of the difference between "make", "build", "install" and "pack"
luarocks install modulename
downloads 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 modulename
downloads a .src.rock or a rockspec and builds+installs it to the local tree.
luarocks build modulename-1.0-1.linux-x86.rock
extracts 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.rockspec
builds+installs the rock using the given rockspec downloading the sources
luarocks make modulename-1.0-1.rockspec
builds+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 sources
luarocks pack modulename
grabs the rock from your local tree and packs it into a binary .rock file
luarocks pack modulename-1.0-1.rockspec
downloads the sources from the url and packs it into a .src.rock file
Lua 的详细介绍:请点这里
Lua 的下载地址:请点这里
推荐阅读:
lua安装教程 linux,Linux 安装 luarocks(lua的模块管理工具)相关推荐
- kubernetes安装_kubernetes安装教程之三:安装kubeadm
kubernetes安装教程之三:安装kubeadm 准备安装包和镜像 安装可以使用VPN下载 ````bash yum --downloadonly --downloaddir=/opt/rpm k ...
- Oracle12c 的安装教程图解(安装系统:windows 2008R2)
Oracle12c 的安装教程图解(安装系统:windows 2008R2) 第一节 安装和下载路径 1 官方下载路径: http://www.oracle.com/cn/products/dat ...
- python35安装教程_python详细安装教程,非常值得看的一篇文章
Python安装教程 本文简单介绍python编程语言的安装教程,python安装有很多方式.你可以直接在官网下载python进行安装,也可以下载Anaconda,本文介绍安装Anaconda的方法. ...
- ArcGIS10.8下载及安装教程(附安装步骤)
谷歌云: https://drive.google.com/drive/folders/10igu7ZSMaR0v0WD7-2W-7ADJGMUFc2ze?usp=sharing ArcGIS10.8 ...
- Git安装教程(Windows安装超详细教程)
Git安装教程(Windows安装超详细教程) weir_will 关注 0.9 2017.10.08 00:59* 字数 728 阅读 17955评论 8喜欢 41 2018年4月14日更新 更 ...
- PHPwind9.01图解安装教程 PHPwind怎么安装方法
PHPwind9.01图解安装教程 PHPwind怎么安装方法http://www.bieryun.com/1238.html PHPwind9.01傻瓜图解安装教程 大家好,按照惯例,PHPwind ...
- ads2019安装教程win10 ads2019安装破解教程 ads安装助手辅助安装
学习目标: 看ads2019安装教程轻松解决在win10电脑上完成ads2019安装 学习内容: 安装ads2019所需要的环境 看ads2019安装教程执行操作 关键地方不要选错 ads安装助手辅助 ...
- 我的世界java版去哪下载光影,《我的世界》中国版光影包详细安装教程 光影怎么安装?...
<我的世界>中国版光影包详细安装教程 光影怎么安装? 2017-08-15 15:17:21来源:网易论坛编辑:评论(0) <我的世界>中国版已经正式开测,玩家在体验游戏时都喜 ...
- Android Studio, 2020.9月最新版下载安装教程+SDK下载安装
Android Studio, 2020.9月最新版下载安装教程+SDK下载安装 一.进入官网下载 二.安装Android Studio 三.安装SDK 一.进入官网下载 1.进入Android St ...
- python软件下载安装教程,python下载安装教程
python下载安装教程 python下载安装教程:自定义安装目录,点击install进行安装,打开cmd窗口,输入python,显示python的版本,安装成功. Python语言更适合初学者,Py ...
最新文章
- Java 18 都要来了,你不会还在用Java 8吧?
- 相同的字符串哈希值一样吗_关于哈希,来看这里!
- 如何将一键还原精灵备份文件复制出来?
- vscode html如何插入模板?(!)
- 数据库BCP命令导入导出数据
- lambda的用法与实例(转载)
- 符号标志位.进位标志位_功能标志的成本是多少?
- 目标检测(一):背景差分法
- Julia: using Gadfly using Cairo的一个郁闷的问题!
- 微信小程序如何使用阿里矢量库
- 【Share Backup】FreeCrawl
- Python批量将TXT文件转为Excel格式
- 【ATSC】美国第二大有线电视公司-Charter
- 帝国cms 首页php,帝国CMS新增加专题页面
- 大型网站架构技术一览(李智慧著.大型网站技术架构.附录A)
- python+django+动态生成word
- 苹果设备如何进入恢复模式
- Moya 设置超时时间和请求头
- gluster分布式存储总结与实践
- python下划线怎么输入_Python中下划线的使用方法有哪些