无法导入cartopy



在google-colab上安装cartopy后,我无法导入它:

!pip install cartopy
import cartopy
ImportError: cannot import name lgeos

可以,通过降低shape:

pip install shapely==1.8.5

对我有用。(in Google colab)

在Colab中安装Cartopy的最佳方法是使用Conda环境。所以我们需要安装以下内容:

#1|Install Conda environment on Colab
!pip install -q condacolab
import condacolab
condacolab.install()

,

#2|Install cartopy 
!mamba install -q -c conda-forge cartopy

之后,

#3|imoprt cartopy 
import cartopy

我遇到了同样的问题(不是使用google-colab),这似乎源于这个Cartopy/shaelyv2.0兼容性问题:https://github.com/SciTools/cartopy/issues/2076.

更多的跟踪:

import cartopy.trace
File "lib/cartopy/trace.pyx", line 77, in init cartopy.trace
ImportError: cannot import name lgeos

我使用pip,并且明确地将shaely降级到1.8.5版本,为我工作。

最新更新