问题
any thoughts? I've tried uninstalling Shapely and installing with PIP I have Anaconda and installed Fiona fine and Shapely seemingly fine. Simple code:
import fiona
import shapely
dirVar = "C:\\Users\\me\\Desktop\\geocode\\"
with fiona.open(dirVar + "Regions.shp") as fiona_collection:
shapefile_record = fiona_collection.next()
shape = shapely.geometry.asShape(shapefile_record['geometry']) #GET ERROR HERE
point = shapely.geometry.Point(32.398516, -39.754028) # longitude, latitude
if shape.contains(point):
print "Found shape for point."
AttributeError: 'module' object has no attribute 'geometry'
When I look at the methods of shapely from Wing IDE I see only:
ctypes_declarations
ftools
geos
I would think I should see geometry if it was installed correctly?
Any thoughts?
回答1:
You could use one of these:
import shapely.geometry
or
from shapely import geometry
来源:https://stackoverflow.com/questions/35978649/python-shapely-install-not-working