database 尝试创建扩展时出现 PostgreSQL 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18696078/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PostgreSQL error when trying to create an extension
提问by Xeen
ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/postgis.control": No such file or directory
ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/postgis.control": No such file or directory
Is what I get when I try to CREATE EXTENSION postgis;can anybody tell me why is it so and what can I do to fix it?
当我尝试CREATE EXTENSION postgis;有人告诉我为什么会这样以及我能做些什么来解决它时,我得到了什么?
回答by dwurf
The following will get you a working postgis install on Ubuntu 12.04 (Note: also tested on 13.10)
以下将使您在 Ubuntu 12.04 上安装 postgis(注意:也在 13.10 上进行了测试)
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/postgis.list
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-9.3-postgis-2.1 postgresql-client-9.3
sudo -u postgres psql -c 'create extension postgis;'
Based on the docs at https://wiki.postgresql.org/wiki/Apt
回答by Roldan Vargas
You need to install postgresql-9.1-postgis-scripts. In Ubuntu or Debian, you need to run the following command as root:
您需要安装postgresql-9.1-postgis-scripts. 在 Ubuntu 或 Debian 中,您需要以 root 身份运行以下命令:
apt-get install postgresql-9.1-postgis-scripts
This adds the files needed to create the postgisextensions.
这将添加创建postgis扩展所需的文件。
回答by Alireza
Installing this package did the trick for me on my Linux Mint 16 box:
在我的 Linux Mint 16 机器上安装这个包对我有用:
# install hstore postgresql extension.
sudo apt-get install postgresql-contrib
回答by Luís de Sousa
Daniel Vérité is close to the truth, but not enough. The package missing is postgresql-9.1-postgis-2.0:
Daniel Vérité 接近真相,但还不够。缺少的包是postgresql-9.1-postgis-2.0:
sudo apt-get install postgresql-9.1-postgis-2.0
回答by Dmitry Lutskov
Just resolved it.
You have to uninstall postgis-1.5. You installed it instaed of PostGIS 2.0. As soon as you will install postgis-2.0you will see corrected libraries in extension directory.
Before installing you should to add a correct repository (see http://docs.pgrouting.org/2.0/en/doc/src/installation/index.html#ubuntu-debian). Use ppa:ubuntugis/ubuntugis-unstablefor PostGIS 2.0.
Try one of
刚刚解决了。您必须卸载 postgis-1.5。您安装了它,而不是 PostGIS 2.0。安装后,postgis-2.0您将在扩展目录中看到更正的库。在安装之前,您应该添加一个正确的存储库(请参阅http://docs.pgrouting.org/2.0/en/doc/src/installation/index.html#ubuntu-debian)。使用ppa:ubuntugis/ubuntugis-unstable了PostGIS的2.0。尝试其中之一
apt-get remove postgis
apt-get remove postgresql-9.1-postgis
apt-get install postgresql-9.1-postgis
I couldn't remove and install because of dependencies error.
After a few attmpts, I just removed postgresql-9.1-postgisand apt-get offer me upgrade it to 2.0.
由于依赖项错误,我无法删除和安装。经过几次尝试后,我刚刚删除了postgresql-9.1-postgisapt-get 建议我将其升级到2.0.0 。
回答by Daniel Vérité
Presumably the postgisversion you installed is 1.5.x which doesn't come as an extension, but as a couple of SQL scripts that need to be manually applied to create the necessary SQL objects.
大概postgis您安装的版本是 1.5.x,它不是作为扩展提供的,而是作为几个需要手动应用以创建必要的 SQL 对象的 SQL 脚本。
Also the postgispackage is not enough, it contains only stuff that doesn't depend on PG version, you need postgresql-9.1-postgis(dpkg -L package-nameis handy to check out the files provided by any particular package).
而且这个postgis包还不够,它只包含不依赖于 PG 版本的东西,你需要postgresql-9.1-postgis(dpkg -L package-name检查任何特定包提供的文件很方便)。
Once the installation paths are known, the official install documentationshould be good enough to set up the template database.
一旦知道安装路径,官方安装文档应该足以设置模板数据库。
回答by CodyBugstein
I had the same problem on my Window 8.1 setup.
我在 Window 8.1 设置上遇到了同样的问题。
I solved it by simply using Application StackBuilderwhich comes with Postgres and installing PostGIS again (despite not having uninstalled it)
我通过简单地使用Application StackBuilderPostgres 附带的并再次安装 PostGIS 来解决它(尽管没有卸载它)
Works fine now!
现在工作正常!
回答by julian
In C:\Program Files\PostgreSQL\9.4 I found uninstall-postgis-bundle-pg94x64-2.1.5-2.exe. Running that fixed my problem, which was caused by a reinstall of PostgreSQL without first uninstalling, and without installing PostGIS the second time around. That's what happens when you more than one person installing stuff..
在 C:\Program Files\PostgreSQL\9.4 我找到了 uninstall-postgis-bundle-pg94x64-2.1.5-2.exe。运行它解决了我的问题,这是由于在没有首先卸载的情况下重新安装 PostgreSQL,并且没有第二次安装 PostGIS 引起的。这就是当你不止一个人安装东西时会发生的事情..
回答by serv-inc
On 14.04, there is postgresql-9.3-postgis-scripts, which containsthe postgis.controlfile.
在 14.04 上,有postgresql-9.3-postgis-scripts,包含该postgis.control文件。
回答by vitthal
Make sure that you have installed this
确保你已经安装了这个
sudo apt-get install postgresql-9.3-postgis
I was facing same issue due to missing this package.
由于缺少此包,我面临同样的问题。

