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   闹不机米  阅读(2113)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示