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 該路徑下
    (原因就是找不到文件,那就手動找到放到它查找的目錄下)

     

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM