未安装 PostGIS 扩展
PostGIS extension not installing
你好,我正在尝试使用以下命令将 postgis 安装到我的数据库之一
CREATE EXTENSION postgis;
但它返回了
的错误
错误:
could not open extension control file "/Library/PostgreSQL/13/share/postgresql/extension/postgis.control": No such file or directory
如何安装 postgis 而不会报错?
更新:
我已经在默认数据库上试过了 postgres.app 给你的是你的桌面用户名(我的是 aarushsharma),我试过了
CREATE EXTENSION postgis;
它起作用了,所以我认为这对我的特定 postgres 用户来说是个问题
首先你需要下载并安装 Postgis,如果你还没有,follow this。
如果你在 Linux 上,你必须安装 2 个软件包,postgis
和 postgresql-13-postgis-3
只有 PostGIS 3,0 及更高版本适用于 Postgresql 13 :
基于 Debian 的发行版上的命令(我从 PostgreSQL 存储库安装):
sudo apt install postgis postgresql-13-postgis-3
在 mac 上,您可以通过 brew
通过 运行 在终端中执行此命令来安装它:
brew install postgis
如果您没有安装 brew
,请先安装它:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
如果您使用postgressApp
安装,请打开终端并输入以下两个命令:
实际上首先按照安装 Postgres.app 文档中的第 3 步进行操作:
sudo mkdir -p /etc/paths.d &&
echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
然后 :
psql -d DATABASE_NAME -f /Applications/Postgres.app/Contents/Versions/[Postgresqlversion]/share/postgresql/contrib/postgis-[PostGisVersion]/postgis.sql
psql -d DATABASE_NAME -f /Applications/Postgres.app/Contents/Versions/[Postgresqlversion]/share/postgresql/contrib/postgis-[PostGisVersion]/spatial_ref_sys.sql
那么您应该可以启用扩展程序了:
CREATE EXTENSION postgis;
我在 Windows + Postgres 14 上遇到了同样的错误。
在 Windows 上,您必须启动“Application Stack Builder”并按照此处所述添加扩展 Postgis:http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_tut01
那么你应该可以创建扩展了。
你好,我正在尝试使用以下命令将 postgis 安装到我的数据库之一
CREATE EXTENSION postgis;
但它返回了
的错误错误:
could not open extension control file "/Library/PostgreSQL/13/share/postgresql/extension/postgis.control": No such file or directory
如何安装 postgis 而不会报错?
更新: 我已经在默认数据库上试过了 postgres.app 给你的是你的桌面用户名(我的是 aarushsharma),我试过了
CREATE EXTENSION postgis;
它起作用了,所以我认为这对我的特定 postgres 用户来说是个问题
首先你需要下载并安装 Postgis,如果你还没有,follow this。
如果你在 Linux 上,你必须安装 2 个软件包,postgis
和 postgresql-13-postgis-3
只有 PostGIS 3,0 及更高版本适用于 Postgresql 13 :
基于 Debian 的发行版上的命令(我从 PostgreSQL 存储库安装):
sudo apt install postgis postgresql-13-postgis-3
在 mac 上,您可以通过 brew
通过 运行 在终端中执行此命令来安装它:
brew install postgis
如果您没有安装 brew
,请先安装它:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
如果您使用postgressApp
安装,请打开终端并输入以下两个命令:
实际上首先按照安装 Postgres.app 文档中的第 3 步进行操作:
sudo mkdir -p /etc/paths.d &&
echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
然后 :
psql -d DATABASE_NAME -f /Applications/Postgres.app/Contents/Versions/[Postgresqlversion]/share/postgresql/contrib/postgis-[PostGisVersion]/postgis.sql
psql -d DATABASE_NAME -f /Applications/Postgres.app/Contents/Versions/[Postgresqlversion]/share/postgresql/contrib/postgis-[PostGisVersion]/spatial_ref_sys.sql
那么您应该可以启用扩展程序了:
CREATE EXTENSION postgis;
我在 Windows + Postgres 14 上遇到了同样的错误。
在 Windows 上,您必须启动“Application Stack Builder”并按照此处所述添加扩展 Postgis:http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_tut01
那么你应该可以创建扩展了。