安装错误:在Windows上安装底图

时间:2018-09-20 23:44:49

标签: python installation matplotlib-basemap

我正在尝试安装底图,使用它似乎效果很好,

conda install -c conda-forge basemap
在anaconda提示符下输入

。但是,当我在jupyternotebook上输入此代码时,

import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

显示错误:

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-2-4fc84cbcc854> in <module>()
  1 import matplotlib.pyplot as plt
----> 2 from mpl_toolkits.basemap import Basemap

~\Documents\DataScience\data\lib\site- 
packages\mpl_toolkits\basemap\__init__.py in <module>()
144 
145 # create dictionary that maps epsg codes to Basemap kwargs.
--> 146 epsgf = open(os.path.join(pyproj.pyproj_datadir,'epsg'))
147 epsg_dict={}
148 for line in epsgf:

FileNotFoundError: [Errno 2] No such file or directory: 'epsg'

1 个答案:

答案 0 :(得分:0)

看起来像matplotlib尝试访问不在同一个conda软件包中的某些信息。

根据某个问题上的this comment,epsg数据位于软件包proj4中,您必须设置环境变量PROJ_LIB,以便matplotlib可以找到它。