0

当我在 django 中迁移时,django
在下面有返回错误

$ python manager.py migrate

django.db.utils.InternalError:无法加载库“/usr/lib/postgresql/9.6/lib/postgis-2.3.so”:/usr/lib/liblwgeom-2.3.so.0:未定义符号:GEOSClipByRect

我研究了很多帖子,但没有找到任何解决方案。
有谁知道解决方案?
我的系统信息如下


$ lsb_release -a

发行商 ID:Ubuntu
描述:Ubuntu 16.04.2 LTS
版本:16.04
代号:xenial



$ dpkg -l | grep postgres

ii postgresql-9.6 9.6.2-1.pgdg16.04+1 amd64 对象关系 SQL 数据库,版本 9.6 服务器
ii postgresql-9.6-pgrouting 2.3.2+ds-2.pgdg16.04+1 amd64 PostgreSQL 路由功能支持/PostGIS
ii postgresql-9.6-pgrouting-scripts 2.3.2+ds-2.pgdg16.04+1 PostgreSQL/PostGIS 的所有路由功能支持 - 脚本
ii postgresql-9.6-postgis-2.3 2.3.2+dfsg-1~exp2 .pgdg16.04+1 amd64 Geographic objects support for PostgreSQL 9.6
ii postgresql-9.6-postgis-2.3-scripts 2.3.2+dfsg-1~exp2.pgdg16.04+1 all Geographic objects support for PostgreSQL 9.6 -- 脚本
ii postgresql-client-9.6 9.6.2-1.pgdg16.04+1 PostgreSQL 9.6 的 amd64 前端程序
ii postgresql-client-common 180.pgdg16.04+1 多个 PostgreSQL 客户端版本的所有管理器
ii postgresql-common 180 .pgdg16.04+1 所有 PostgreSQL 数据库集群管理器
ii postgresql-contrib 9.6+180.pgdg16.04+1 所有 PostgreSQL 附加设施(支持的版本)
ii postgresql-contrib-9.6 9.6.2-1.pgdg16.04+ 1 用于 PostgreSQL 的 amd64 附加设施



$ dpkg -l | grep postgres

ii postgis 2.3.2+dfsg-1~exp2.pgdg16.04+1 amd64 Geographic objects support for PostgreSQL
ii postgis-doc 2.3.2+dfsg-1~exp2.pgdg16.04+1 all Geographic objects support for PostgreSQL --文档
ii postgresql-9.6-postgis-2.3 2.3.2+dfsg-1~exp2.pgdg16.04+1 amd64 PostgreSQL 9.6 的地理对象支持
ii postgresql-9.6-postgis-2.3-scripts 2.3.2+dfsg-1~exp2 .pgdg16.04+1 所有 Geographic 对象支持 PostgreSQL 9.6 -- 脚本

4

1 回答 1

1

您很可能使用的是旧版本的 GEOS(我猜是 3.4。您可以通过运行 geos-config --version 找到版本)。您需要做的是卸载当前版本的 GEOS 并重新安装较新的版本:

从 /usr/bin /usr/local/bin usr/lib usr/local/lib 中删除 geos 文件。应该很容易识别

运行以下命令安装 3.5 版:

$ wget http://download.osgeo.org/geos/geos-3.5.1.tar.bz2

$ tar xjf geos-3.5.1.tar.bz2

$ cd geos-3.5.2

$ ./configure

$ make

$ sudo make install

$ sudo ldconfig

编辑:为您的项目使用最相关的 GEOS 版本。不强制使用 3.5

于 2018-06-08T10:00:01.813 回答