Sono un principiante a fare/stampare su mappe con python, ho cercato di seguire questo blogpost per generare una mappa del mondo (http://sciblogs.co.nz/seeing- dati/2011/08/12/plotting-geografico-dati-on-a-world-map-con-python /). Si è bloccato con un paio di cose qui:OSError geos_c non è stato trovato durante l'installazione di Shapely
Installazione di mappa di base (un'estensione Matplotlib per tracciare i dati sulle proiezioni geografiche).
from mpl_toolkits.basemap import Basemap Traceback (most recent call last): File "geos_demo.py", line 1, in <module> from mpl_toolkits.basemap import Basemap ImportError: No module named mpl_toolkits.basemap
Installare ben fatto, ma il seguente errore si verifica [1]:
Poi sono andato nel file geos.py e cambiare tutti i riferimenti di geos.dll a geos_c.dll, come raccomandato tramite il collegamento qui: http://osgeo-org.1560.n6.nabble.com/osgeo4w-258-Problems-with-python-shapely-python-2-7-2-td4336816.html
Tuttavia, si verifica lo stesso errore [1].
Sto usando Python 2.7.1 e Mac OS 10.7.4. Per favore fatemi sapere se posso fornire ulteriori informazioni e apprezzare davvero qualsiasi guida dalla comunità qui! Grazie!
[1]
from shapely.geometry import Point
Traceback (most recent call last): File "<stdin>", line 1, in <module>
File "/Users/Desktop/python/ENV/lib/python2.7/site-packages/shapely/geometry/__init__.py", line 4, in <module>
from geo import box, shape, asShape, mapping
File "/Users/Desktop/python/ENV/lib/python2.7/site-packages/shapely/geometry/geo.py", line 5, in <module>
from point import Point, asPoint
File "/Users/Desktop/python/ENV/lib/python2.7/site-packages/shapely/geometry/point.py", line 7, in <module>
from shapely.coords import required
File "/Users/Desktop/python/ENV/lib/python2.7/site-packages/shapely/coords.py", line 8, in <module>
from shapely.geos import lgeos
File "/Users/Desktop/python/ENV/lib/python2.7/site-packages/shapely/geos.py", line 59, in <module>
_lgeos = load_dll('geos_c', fallbacks=alt_paths)
File "/Users/Desktop/python/ENV/lib/python2.7/site-packages/shapely/geos.py", line 44, in load_dll
libname, fallbacks or []))
OSError: Could not find library geos_c or load any of its variants ['/Library/Frameworks/GEOS.framework/Versions/Current/GEOS', '/opt/local/lib/libgeos_c.dylib']
Grazie @aychedee.Ho installato numpy e non riuscivo a capire la mappa di base. PythonAnywhere aiuta a installare la mappa di base insieme alle altre librerie? – msunbot
Ciao Michelle, in realtà la mappa di base è già installata come pacchetto standard. L'unica differenza nel portare a termine questo tutorial sarebbe che dovresti salvare la trama come un file e quindi scaricarla piuttosto che visualizzarla direttamente. – aychedee