gpt4 book ai didi

linux - 如何在Linux CentOS 7 上安装luasql?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:40:39 25 4
gpt4 key购买 nike

我尝试安装 luasql在我的 Linux CentOS 7 计算机上使用以下命令:

luarocks 安装 luasql-postgres

但不幸的是我得到了以下错误:

Installing https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luasql-postgres-2.3.5-2.rockspec...
Using https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luasql-postgres-2.3.5-2.rockspec... switching to 'build' mode

Error: Could not find header file for PGSQL
No file libpq-fe.h in /usr/local/include
No file libpq-fe.h in /usr/include
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

然后我尝试运行最后一行 luarocks install luasql-postgres PGSQL_DIR=/usr/local 但我没有任何改进......

我该怎么办?

最佳答案

这个的 Lua 位很好;你得到的错误是 C 位不存在。

一般来说,当您与 C 库交互时,您需要确保安装了 C 库的 -dev(对于 Debianish)或 -devel(对于 Redhatish)包。

在你的情况下,你可能只需在你的盒子上以 root 身份执行以下操作:

yum install postgresql-devel

...然后再次尝试安装 luarocks。

或者,您可以尝试使用操作系统 native 包:

yum install lua-sql-postgresql

我个人更喜欢将操作系统包用于稳定的 Lua 库,这些库不会有太大变化,但这是你的决定......

关于linux - 如何在Linux CentOS 7 上安装luasql?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43149280/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com