Python cartopy:导入cartopy.crs错误
我正在为Python cartopy:导入cartopy.crs错误,python,python-xarray,cartopy,rasterio,Python,Python Xarray,Cartopy,Rasterio,我正在为xarray做一些开发工作。我试图安装rasterio,但它似乎把我的cartopy安装搞砸了 我在mac上安装了rasterio,使用的是: brew install gdal pip install rasterio 现在,当我尝试将cartopy.crs导入为CCR时,我得到了错误 Invalid argument (must be a Polygon) Geometry must be a Point or LineString Assertion failed: (0 !=
xarray
做一些开发工作。我试图安装rasterio
,但它似乎把我的cartopy
安装搞砸了
我在mac上安装了rasterio
,使用的是:
brew install gdal
pip install rasterio
现在,当我尝试将cartopy.crs导入为CCR时,我得到了错误
Invalid argument (must be a Polygon)
Geometry must be a Point or LineString
Assertion failed: (0 != cs), function GEOSCoordSeq_getSize_r, file geos_ts_c.cpp, line 3991.
Abort trap: 6
可能更改了GEOS
、PROJ4
或GDAL
的路径/版本
是否有一种方法可以干净地安装cartopy
,从而获取依赖项
我最初使用conda安装-c conda forge cartopy安装了cartopy
。执行conda update cartopy
实际上没有任何作用,因为我有最新版本
任何帮助都将不胜感激,因为我用cartopy完成了大部分工作
编辑:这里有一些关于这个的讨论
$geos配置--版本
3.6.2
尝试
但是没有用cartopy
从brew安装gdal
中拾取geos
目录。因此,我使用以下方法删除了此项:
$ brew tap beeftornado/rmtree
$ brew rmtree gdal
$ brew uninstall --ignore-dependencies proj
$ brew uninstall --ignore-dependencies geos
$ brew uninstall --ignore-dependencies json-c
$ brew uninstall --ignore-dependencies freexl
$ brew uninstall --ignore-dependencies liblwgeom
cartopy
然后正确地选择了geos
目录,该目录是在conda
安装cartopy
期间安装的。您是否也从conda安装了gda
l和rasterio
?您应该能够通过conda安装-c conda forge xarray cartopy rasterio gdal…
获得所需的所有依赖项,并且conda应该能够找到库/版本的正确组合。根据我的经验,混合brew/pip/conda可能会导致问题。谢谢。我无法使用rasterio安装conda
,因此我选择了另一种mac安装方式,尽管现在我正在为此付费。不幸的是,新的conda安装似乎没有帮助。虽然这个代码片段可能是解决方案,但确实有助于提高文章的质量。请记住,您将在将来回答读者的问题,这些人可能不知道您的代码建议的原因。
$ brew tap beeftornado/rmtree
$ brew rmtree gdal
$ brew uninstall --ignore-dependencies proj
$ brew uninstall --ignore-dependencies geos
$ brew uninstall --ignore-dependencies json-c
$ brew uninstall --ignore-dependencies freexl
$ brew uninstall --ignore-dependencies liblwgeom