如何在Linux Ubuntu 16上安装luasql?

感谢StackOverflow社区的帮助,我成功地在我的运行Linux CentOS 7的计算机上正确地安装了luasql。

现在我在Linux Ubuntu 16上遇到了一个类似的问题。我尝试了以下命令:

sudo apt-get -y install lua-sql-postgres
sudo apt-get -y install lua-sql-postgres-dev
sudo luarocks install luasql-postgres

这是系统返回的错误信息:

Installing https://rocks.moonscript.org/luasql-postgres-2.3.5-2.rockspec...
Using https://rocks.moonscript.org/luasql-postgres-2.3.5-2.rockspec... switching to 'build' mode

Error: Could not find expected file libpq-fe.h, or libpq-fe.h for PGSQL -- you may have to install PGSQL in your system and/or pass PGSQL_DIR or PGSQL_INCDIR to the luarocks command. Example: luarocks install luasql-postgres PGSQL_DIR=/usr/local

有人知道如何解决这个问题吗? 谢谢

点赞
用户4491743
用户4491743

请安装 libpq-dev 包:

文件 libpq-fe.h 位于 /usr/include/postgresql/http://packages.ubuntu.com/xenial-updates/amd64/libpq-dev/filelist

2017-04-04 02:31:36
用户4635560
用户4635560

正如 @Knud Larsen 建议的那样:

首先,你需要安装 libpq-dev

如果安装成功,你会看到文件 /usr/include/postgresql/libpq-fe.h

之后执行以下命令:

sudo luarocks PGSQL_INCDIR=/usr/include/postgresql/ install luasql-postgres
2017-04-06 18:59:30