Cartopy 安装
-
使用说明,如何画图
import cartopy.crs as ccrs import matplotlib.pyplot as plt from cnmaps import get_adm_maps, draw_map jingjinji = get_adm_maps('北京市') + get_adm_maps('天津市') + get_adm_maps('河北省') fig = plt.figure(figsize=(10, 10)) ax = fig.add_subplot(111, projection=ccrs.PlateCarree()) draw_map(jingjinji, color='k') plt.show()
参考: 简单:https://www.zhihu.com/question/267824560/answer/2345781699
详细:https://zhajiman.github.io/post/cartopy_introduction/
http://www.360doc.com/content/22/0724/16/11604731_1041209399.shtml
气象图:https://www.icode9.com/content-4-846493.html -
Linux安装
直接pip install Cartopy安装为最新版本,需要依赖GEOS
和PROJ.4
所以安装稳定版本 Cartopy==0.19.0.post1 一次性安装成功
pip install Cartopy==0.19.0.post1 -i https://mirrors.aliyun.com/pypi/simple
-
win安装
安装依赖包 (没有列举的自己pip下载安装,或下载 whl 文件安装) https://www.lfd.uci.edu/~gohlke/pythonlibs/ 下载地址 pip install pyshp -i https://mirrors.aliyun.com/pypi/simple pip install pyproj-3.2.1-cp37-cp37m-win_amd64.whl pip install --upgrade --no-binary shapely shapely -i https://mirrors.aliyun.com/pypi/simple pip install Cartopy-0.20.2-cp37-cp37m-win_amd64.whl
参考:https://www.cnblogs.com/eroeg/p/16136437.html安装参考 Linux win 都有 Cartopy 简介与安装 (gnss.help)
-
import cartopy.trace ImportError: DLL load failed: 找不到指定的模块
shapely 包的原因 1. 先删除 shapely 和 cartopy 包 pip uninstall shapely Cartopy -y 2. 在安装 shapely (有网友说1.8.1(和 1.8.1.post1)导致 cartopy 崩溃。将 Shapely 降级到 1.8.0 可以解决此问题,但是我试过不行) pip install --upgrade --no-binary shapely shapely -i https://mirrors.aliyun.com/pypi/simple 3. 在安装 cartopy pip install Cartopy-0.20.2-cp37-cp37m-win_amd64.whl
-
Could not find lib geos_c.dll or load any of its variants []
解决办法,到安装python的路径上搜索 geos_c 文件 然后把 文件较大的 复制到 C:\Users\admin\AppData\Local\Programs\Python\Python37\DLLs 该路径下 (原因就是找不到文件,那就手动找到放到它查找的目录下)
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)