你好,我试图用下面的命令将postgis安装到我的一个数据库中
CREATE EXTENSION postgis;但它返回了一个错误
错误:
无法打开扩展控制文件"/Library/PostgreSQL/13/share/postgresql/extension/postgis.control":没有这样的文件或目录
如何在不出错的情况下安装postgis?
更新:我已经在postgres.app提供的默认数据库上尝试过它,这是您的桌面用户名(我的是aarushsharma),我试过这样做。
CREATE EXTENSION postgis;它起作用了,所以我认为这与我的特定postgres用户有关是个问题
发布于 2021-02-28 19:07:33
首先,如果您还没有下载并安装Postgis,跟着这个。
如果您在Linux上,您必须安装两个包,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;发布于 2022-01-19 13:35:08
我在Windows + Postgres 14上也有同样的错误。
在Windows上,您必须启动“应用程序堆栈生成器”并添加扩展Postgis,如下所示:tut01
然后,您应该能够创建扩展。
https://stackoverflow.com/questions/66411176
复制相似问题