简体   繁体   中英

Python GEOS ImportError

I'm getting this error:

ImportError: Could not find the GEOS library (tried ""geos_c"", ""libgeos_c-1"").  
Try setting GEOS_LIBRARY_PATH in your settings

when I run:

from django.contrib.gis.geos import *
pnt=GEOSGeometry('POINT(23 5)')
print(pnt)

I added GEOS_LIBRARY_PATH = 'C:/Python34/Lib/site-packages/osgeo/geos_c.dll'
in C:\\Python34\\Lib\\site-packages\\django\\conf\\project_template\\project_name\\settings.py

But still Im getting the same error. How to solve this?

I don't know what is the most correct way to use with Windows, you can try to find solution here , but for ubuntu command:

sudo apt-get install binutils libproj-dev gdal-bin

solved the problem.

PS From dock:

The setting must be the full path to the C shared library; in other words you want to use libgeos_c.so, not libgeos.so.

Extension of the library must be *_c.so

Are You sure path is correct? This is My path:

GEOS_LIBRARY_PATH = 'c:\\Program Files\\PostgreSQL\\9.1\\bin\\libgeos_c-1'

You need GEOS from PostgreSQL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM