2017-04-03 150 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

它解決了,謝謝! –