1.确认有pip
2.Unofficial Windows Binaries for Python Extension Packages(提供非官方的Windows环境下Python扩展包)网站下载相关包
由于安装basemap包前需要有pyproj,所以下载两个相关包:
a===>basemap 1.1.0 cp36 cp36m win_amd64.whl
b===>pyproj 1.9.5.1 cp36 cp36m win_amd64.whl
3.打开anaconda prompt,进入刚下载的包的目录下
F: (回车)
4.安装两个包
a===>pip install pyproj-1.9.5.1-cp36-cp36m-win_amd64.whl
b===>pip install basemap-1.1.0-cp36-cp36m-win_amd64.whl
提示成功
5.测试
from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt # setup Lambert Conformal basemap. m = Basemap(width=12000000,height=9000000,projection='lcc', resolution='c',lat_1=45.,lat_2=55,lat_0=50,lon_0=-107.) # draw coastlines. m.drawcoastlines() # draw a boundary around the map, fill the background. # this background will end up being the ocean color, since # the continents will be drawn on top. m.drawmapboundary(fill_color='aqua') # fill continents, set lake color same as ocean color. m.fillcontinents(color='coral',lake_color='aqua') plt.show()
好啦,大功告成啦!
参考资料:http://matplotlib.org/basemap/users/geography.html