Basemap library using Anaconda Jupyter Notebooks - KeyError: PROJ_LIB

后端 未结 5 510
情书的邮戳
情书的邮戳 2020-12-15 08:05

I\'m trying to install and import the Basemap library into my Jupyter Notebook, but this returns the following error:

KeyError: \'PROJ_LIB\'
<
5条回答
  •  情深已故
    2020-12-15 08:38

    In Windows 10 command line: first find the directory where the epsg file is stored:

    where /r "c:\Users\username" epsg.*
    

    ...

    c:\Users\username\AppData\Local\conda\conda\envs\envname\Library\share\epsg

    ...

    then either in command line:

    activate envname
    
    SET PROJ_LIB=c:\Users\username\AppData\Local\conda\conda\envs\envname\Library\share
    

    (make sure there are no leading on trailing spaces in the path!) and then

    jupyter notebook
    

    or add this to your jupyter notebook (as suggested by john ed):

    import os
    
    os.environ['PROJ_LIB'] = r'c:\Users\username\AppData\Local\conda\conda\envs\envname\Library\share'
    

提交回复
热议问题