Python Shapely Install Not working?

纵饮孤独 提交于 2020-06-12 09:01:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!