GeoDjango GEOSException错误 [英] GeoDjango GEOSException error

查看:118
本文介绍了GeoDjango GEOSException错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在我的机器上安装GeoDjango。我真的很喜欢Python,被带入一个对其他团队成员来说非常棘手的项目。我使用brew安装了Python 2.7和GEOS,并运行了PSQL 9.2.4,但是当我尝试使网络服务器运行时,不断得到这个错误:

Trying to install a GeoDjango on my machine. I'm really new to Python and being brought into a project that has been a very tricky install for the other team members. I installed Python 2.7 and GEOS using brew, and running PSQL 9.2.4 but keep getting this error when I try to get the webserver running:

__import__(name)
File "/Users/armynante/Desktop/uclass-files/uclass-env/lib/python2.7/site
packages/django/contrib/gis/geometry/backend/geos.py", line 1, in <module>
from django.contrib.gis.geos import (
File "/Users/armynante/Desktop/uclass-files/uclass-env/lib/python2.7/site
packages/django/contrib/gis/geos/__init__.py", line 6, in <module>
from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex
File "/Users/armynante/Desktop/uclass-files/uclass-env/lib/python2.7/site
packages/django/contrib/gis/geos/geometry.py", line 14, in <module>
from django.contrib.gis.geos.coordseq import GEOSCoordSeq
File "/Users/armynante/Desktop/uclass-files/uclass-env/lib/python2.7/site-
packages/django/contrib/gis/geos/coordseq.py", line 9, in <module>
from django.contrib.gis.geos.libgeos import CS_PTR
File "/Users/armynante/Desktop/uclass-files/uclass-env/lib/python2.7/site-
packages/django/contrib/gis/geos/libgeos.py", line 119, in <module>
_verinfo = geos_version_info()
File "/Users/armynante/Desktop/uclass-files/uclass-env/lib/python2.7/site
packages/django/contrib/gis/geos/libgeos.py", line 115, in geos_version_info
if not m: raise GEOSException('Could not parse version info string "%s"' % ver)
django.contrib.gis.geos.error.GEOSException: Could not parse version info string
"3.4.2-CAPI-1.8.2 r3921"

似乎在SO或网络上找到与此跟踪相关的任何内容。我认为这可能是正则表达式失败?我正在尝试重新安装PSQL和GEOS,看看我能不能运行它。

Cant seem to find anything relevant to this trace on SO or the web. I think it might be a regex failure? I'm currently trying to reinstall PSQL and GEOS to see if I can get it running.

这是我的需求文件:

django==1.4
psycopg2==2.4.4
py-bcrypt==0.4
python-memcached==1.48
south==0.7.3

# Debug Tools
sqlparse==0.1.3
django-debug-toolbar==0.9.1
django-devserver==0.3.1

# Deployment
fabric==1.4

# AWS
# boto==2.1.1
django-storages==1.1.4
django-ses==0.4.1

# ECL
http://packages.elmcitylabs.com/ecl_django-0.5.3.tar.gz#ecl_django
http://packages.elmcitylabs.com/ecl_google-0.2.14.tar.gz#ecl_google
# https://packages.elmcitylabs.com/ecl_tools-0.3.7.tar.gz#ecl_tools
# https://packages.elmcitylabs.com/chargemaster-0.2.19.tar.gz
# https://packages.elmcitylabs.com/ecl_facebook-0.3.12.tar.gz#ecl_facebook
# https://packages.elmcitylabs.com/ecl_twitter-0.3.3.tar.gz#ecl_twitter

# Search
#https://github.com/elmcitylabs/django-haystack/tarball/issue-522#django-haystack
-e git+https://github.com/toastdriven/django-haystack.git#egg=django-haystack

pysolr==2.1.0-beta
# whoosh==2.3.2

# Misc
# PIL
# django-shorturls==1.0.1
# suds==0.4

django-mptt
sorl-thumbnail

stripe
pytz==2013b


推荐答案

这是我的解决方案(显然这是丑的,就像我的英文,但是工作)。
问题是版本字符串在RegEx中不需要空格。

This is my solution (obviously it is ugly, like my English, but works). The problem is that the versions string has an white space unwanted in the RegEx.

错误说:

GEOSException:无法解析版本信息字符串3.4.2-CAPI-1.8.2 r3921

而geos_version_info警告:

And the geos_version_info warns:

正则表达式应该可以解析版本字符串,如
'3.0.0rc4-CAPI-1.3.3','3.0.0 -CAPI-1.4.1'或'3.4.0dev-CAPI-1.8.0'

编辑此文件 packages / django / contrib / gis / geos / libgeos.py

Edit this file: site-packages/django/contrib/gis/geos/libgeos.py

查找功能: geos_version_info

Look for the function: geos_version_info

并更改此行:

ver = geos_version()。decode()

ver = geos_version().decode()

使用此行:

ver = geos_version()。decode()。split('')[ 0]

ver = geos_version().decode().split(' ')[0]

这篇关于GeoDjango GEOSException错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆