[英]Unable to import cartopy
在 google-colab 上安裝 cartopy 后,我無法導入 cartopy。
!pip install cartopy import cartopy
ImportError: cannot import name lgeos
在 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/Shapely v2.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,並明確地將 Shapely 降級到1.8.5
版本對我有用。
是的,通過 shapely 降級:pip install shapely==1.8.5 對我有用。 (在谷歌協作中)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.