Ubuntu 14.04 + liblwgeom-2.1.1 postgres
我之前在电脑上有一个项目运行得很好,但我决定把我的Ubuntu系统更新到14.04,结果我的项目就不工作了 =[
我在用Python/Django和Postgres,还用了一些库:
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.measure import D
from django.contrib.auth.models import User
现在当我运行一个使用这些库的脚本时,出现了以下错误:
Internal Server Error: /get-menus-categorized/
Traceback (most recent call last):
File "/home/bug/virtualenvs/menuchefs/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/home/bug/projects/menuchef/menuchef/core/views.py", line 985, in get_menus_categorized
item = {'id':menu.id, 'title':menu.title, 'photo':menu.photo.url, 'description':menu.description, 'restaurant_slug':menu.restaurant.slug, 'number_of_likes':menu.number_of_likes}
File "/home/bug/virtualenvs/menuchefs/local/lib/python2.7/site-packages/django/db/models/fields/related.py", line 384, in __get__
rel_obj = qs.get(**params)
File "/home/bug/virtualenvs/menuchefs/local/lib/python2.7/site-packages/django/db/models/query.py", line 382, in get
num = len(clone)
File "/home/bug/virtualenvs/menuchefs/local/lib/python2.7/site-packages/django/db/models/query.py", line 90, in __len__
self._result_cache = list(self.iterator())
File "/home/bug/virtualenvs/menuchefs/local/lib/python2.7/site-packages/django/db/models/query.py", line 301, in iterator
for row in compiler.results_iter():
File "/home/bug/virtualenvs/menuchefs/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 775, in results_iter
for rows in self.execute_sql(MULTI):
File "/home/bug/virtualenvs/menuchefs/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 840, in execute_sql
cursor.execute(sql, params)
File "/home/bug/virtualenvs/menuchefs/local/lib/python2.7/site-packages/django/db/backends/util.py", line 41, in execute
return self.cursor.execute(sql, params)
File "/home/bug/virtualenvs/menuchefs/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 58, in execute
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
File "/home/bug/virtualenvs/menuchefs/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 54, in execute
return self.cursor.execute(query, args)
DatabaseError: could not load library "/usr/lib/postgresql/9.3/lib/postgis-2.1.so": /usr/lib/liblwgeom-2.1.2.so: undefined symbol: GEOSDelaunayTriangulation
我在考虑把Ubuntu版本降级,有人知道该怎么做吗?
1 个回答
2
我在进行一次标准的 apt-get upgrade
更新后,也遇到了同样的问题,这次更新里包括了 PG 9.3 的 postgis。
Preparing to replace liblwgeom-2.1.2 2.1.2+dfsg-1.pgdg12.4+4 (using .../liblwgeom-2.1.2_2.1.3+dfsg-1.pgdg12.4+7_i386.deb) ...
Unpacking replacement liblwgeom-2.1.2 ...
(...)
Preparing to replace postgresql-9.3-postgis-scripts 2.1.2+dfsg-1.pgdg12.4+4 (using .../postgresql-9.3-postgis-scripts_2.1.3+dfsg-3.pgdg12.4+2_all.deb) ...
Unpacking replacement postgresql-9.3-postgis-scripts ...
Preparing to replace postgresql-9.3-postgis-2.1-scripts 2.1.2+dfsg-1.pgdg12.4+4 (using .../postgresql-9.3-postgis-2.1-scripts_2.1.3+dfsg-3.pgdg12.4+2_all.deb) ...
Unpacking replacement postgresql-9.3-postgis-2.1-scripts ...
(...)
Setting up liblwgeom-2.1.2 (2.1.3+dfsg-1.pgdg12.4+7) ...
(...)
Setting up postgresql-9.3-postgis-scripts (2.1.3+dfsg-3.pgdg12.4+2) ...
Setting up postgresql-9.3-postgis-2.1-scripts (2.1.3+dfsg-3.pgdg12.4+2) ...
看起来 liblwgeom-2.1.3.so
替代了之前的 2.1.2 版本。你可以在 /usr/lib
目录下创建一个符号链接,这样就能再次正常使用了:
sudo ln -s liblwgeom-2.1.3.so liblwgeom-2.1.2.so
扩展功能可以加载,我也能处理空间数据了,不过我还没有进行全面的测试来确认所有功能是否都正常(不过一般来说,次要版本的升级通常不会有兼容性问题)。