我已经在我的电脑上安装了64位python 2.7。当我写出导入的形状时它工作正常。但是上面的错误来自以下代码:
import numpy as np
from scipy.spatial import Voronoi, voronoi_plot_2d
import shapely.geometry
import shapely.ops
points = np.random.random((10, 2))
vor = Voronoi(points)
voronoi_plot_2d(vor)
lines = [
shapely.geometry.LineString(vor.vertices[line])
for line in vor.ridge_vertices
if -1 not in line
]
for poly in shapely.ops.polygonize(lines):
print poly
错误:
Traceback (most recent call last):
File "C:\Users\Shikha\Desktop\vorn.py", line 3, in <module>
import shapely.geometry
File "C:\Python27\lib\site-packages\shapely-1.5.9-py2.7.egg\shapely\geometry\__init__.py", line 4, in <module>
from .base import CAP_STYLE, JOIN_STYLE
File "C:\Python27\lib\site-packages\shapely-1.5.9-py2.7.egg\shapely\geometry\base.py", line 9, in <module>
from shapely.coords import CoordinateSequence
File "C:\Python27\lib\site-packages\shapely-1.5.9-py2.7.egg\shapely\coords.py", line 8, in <module>
from shapely.geos import lgeos
File "C:\Python27\lib\site-packages\shapely-1.5.9-py2.7.egg\shapely\geos.py", line 145, in <module>
prototype(_lgeos, geos_version)
File "C:\Python27\lib\site-packages\shapely-1.5.9-py2.7.egg\shapely\ctypes_declarations.py", line 252, in prototype
lgeos.GEOSCovers.restype = c_byte
File "C:\Python27\lib\ctypes\__init__.py", line 378, in __getattr__
func = self.__getitem__(name)
File "C:\Python27\lib\ctypes\__init__.py", line 383, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'GEOSCovers' not found