2017-04-03 152 views
6

感谢StackOverflow社区的帮助,我能够在我的computer running Linux CentOS 7上正确安装luasql。如何在Linux Ubuntu 16上安装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 

有谁知道解决这个问题? 感谢

+0

请安装'的libpq-dev':该文件是'/ usr/include目录/ postgresql/libpq-fe.h' http://packages.ubuntu.com/xenial-updates/amd64/libpq-dev/filelist –

回答

6

至于建议的@Knud拉森:

首先,您需要安装libpq-dev

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

之后,执行命令:

sudo luarocks PGSQL_INCDIR=/usr/include/postgresql/ install luasql-postgres 
+0

它解决了,谢谢! –