ps:
最近在搞Lua脚本,所以搭个环境玩玩。
网上已经有很多教程了,但是很多方法都不太好使,
因为系统版本和软件版本都在变化,每个人的电脑环境配置也不尽相同,
可能我这篇的内容也只适合于现在的版本。
我的PC环境:
zc@PC:~/lua-5.3.4$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.10
Release: 16.10
Codename: yakkety
zc@PC:~/lua-5.3.4$ getconf LONG_BIT
64
Lua安装步骤:
0)下载:到http://www.lua.org/download.html现在最新Lua版本,当下最新版为Lua5.3.4
1)将安装包Lua5.3.4.tar.gz移动到/Home/$USER 目录下(个人喜好)
2)解压:sudo tar -zxvf lua-5.3.4.tar.gz
3)编译:
<span style="color:#cc33cc">cd lua-5.3.4/
sudo make linux test</span>
一般会出现编译错误:
lua.c:82:31: fatal error: readline/readline.h: No such file or directory
#include <readline/readline.h>
^
compilation terminated.
<builtin>: recipe for target 'lua.o' failed
make[2]: *** [lua.o] Error 1
make[2]: Leaving directory '/home/zc/Downloads/lua-5.3.4/src'
Makefile:110: recipe for target 'linux' failed
make[1]: *** [linux] Error 2
make[1]: Leaving directory '/home/zc/Downloads/lua-5.3.4/src'
Makefile:55: recipe for target 'linux' failed
make: *** [linux] Error 2
4)解决编译错误
sudo apt-get install libreadline7 libreadline-dev
5)再次编译
sudo make linux test
6)创建链接
root@donghua:/home/donghua/Download/lua/lua-5.3.5# sudo ln -s /home/donghua/Download/lua/lua-5.3.5/src/lua /usr/bin/
root@donghua:/home/donghua/Download/lua/lua-5.3.5# lua
Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio
> print("Hello")
Hello
>
7)测试
<span style="color:#cc33cc;">zc@PC:~$ lua
Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio
> print("Hello :)")
Hello :)
> </span>
zc@PC:~$ lua
Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio
> print("Hello :)")
Hello :)
>
————————————————
版权声明:本文为CSDN博主「SAYALO」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_23954569/java/article/details/70879672