basemap工具包可以让我们使用Python在地图上绘制2D数据 听起来酷毙了吗
结果本人花了整整一个白天在macOS的python3.6下装basemap工具包 (猛虎流泪 菜是原罪
首先有问题当然是dudu优先,百度有很多种方法在各种操作系统下安装basemap。
1/ 直接使用pip install basemap,报错:
ERROR: Could not find a version that satisfies the requirement basemap (from versions: none) ERROR: No matching distribution found for basemap
2/
pip install https://github.com/matplotlib/basemap/archive/master.zip在build wheel的时候报错了
fatal error: ‘geos_c.h’ file not found
3/ 下载.tar包然后pip install *.tar.gz
第一次出现
Command “python setup.py egg_info” failed with error code 1
需要对geos的环境路径进行设定,(很多博客里都涉及到可以去看看),在export之前最好对gcc进行升级,不然会出现新的error…
4/ 在conda环境下用conda进行package安装conda install -c anaconda basemap
ps:官方链接
成功!
from mpl_toolkits.basemap import Basemap仍有报错KeyError 'PROJ_LIB' 解决:在import basemap前设定环境变量
os.environ['PROJ_LIB'] = '/Users/../anaconda3/share/proj'就能够使用Basemap进行酷酷der2D的地图展示了 ✌️