colaboratory中的Python底图

colaboratory中的Python底图

本文介绍了Google colaboratory中的Python底图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经使用以下命令在google colaboratory中安装libgeos和basemap,并且直到上周都可以正常工作.

I used to use the following commands to install libgeos and basemap in google colaboratory and it worked perfectly until last week.

!apt-get -qq install libgeos-dev
!pip install -qq https://github.com/matplotlib/basemap/archive/master.zip
from mpl_toolkits.basemap import Basemap, cm

错误显示

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-f27b0fbc3a52> in <module>()
----> 1 from mpl_toolkits.basemap import Basemap, cm
      2 from matplotlib.patches import Polygon

/usr/local/lib/python3.6/dist-packages/mpl_toolkits/basemap/__init__.py in
<module>()
150
151 # create dictionary that maps epsg codes to Basemap kwargs.
--> 152 epsgf = open(os.path.join(pyproj.pyproj_datadir,'epsg'))
153 epsg_dict={}
154 for line in epsgf:

AttributeError: module 'pyproj' has no attribute 'pyproj_datadir'

有没有人知道如何解决它?谢谢.

Is there anyone know how to fix it? Thanks.

推荐答案

似乎与pyproj最新版本(2.0.1)有关,该版本已于2019年3月10日发布.尝试安装旧版本的pyproj,例如. pip install pyproj==1.9.6

It seems to have something to do with the latest pyproj release (2.0.1), which was released on 10.03.2019. Try installing older version of pyproj, eg. pip install pyproj==1.9.6

这篇关于Google colaboratory中的Python底图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 09:32