Cartopy 安装

  1. 使用说明,如何画图

    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

  2. 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


    参考 :试过一次不行,可能是基础环境不同把
    https://blog.csdn.net/SOPHIA16527/article/details/108324704?utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~aggregatepage~first_rank_ecpm_v1~rank_v31_ecpm-14-108324704.pc_agg_new_rank&utm_term=cartopy%E5%AE%89%E8%A3%85%E6%8A%A5%E9%94%99&spm=1000.2123.3001.4430

  3. 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)

  4. 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
        

    参考网址 :https://github.com/SciTools/cartopy/issues/2006

  5. 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 该路径下
    (原因就是找不到文件,那就手动找到放到它查找的目录下)

     

  

 

posted on 2022-01-24 15:24  闹不机米  阅读(1976)  评论(0编辑  收藏  举报

导航