底图导入但没有“ TypeError:'模块'对象不可调用”

时间:2019-08-13 10:22:20

标签: python jupyter-notebook matplotlib-basemap

尝试从此处在Mac High Sierra上重新创建地球图: https://jakevdp.github.io/PythonDataScienceHandbook/04.13-geographic-data-with-basemap.html

通过pip-3.7 / macports和以下内容安装了底图和必备组件:

sudo pip-3.7 install https://github.com/matplotlib/basemap/archive/master.zip

尝试根据旧帖子恢复为matlibplot == 2.2: Installing basemap on Mac / Python

import mpl_toolkits.basemap as Basemap
plt.figure(figsize=(8, 8))
m = Basemap(projection='ortho', resolution=None, lat_0=50, lon_0=-100)
m.bluemarble(scale=0.5);

错误:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-15-94e6d5b6740c> in <module>
      5 import mpl_toolkits.basemap as Basemap
      6 plt.figure(figsize=(8, 8))
----> 7 m = Basemap(projection='ortho', resolution=None, lat_0=50, lon_0=-100)
      8 m.bluemarble(scale=0.5);

TypeError: 'module' object is not callable

现在不确定从这里要去哪里,因为它好像正在导入底图,但是版本或某些内容不正确?也许电话打错了?我将检查下一个,但是任何指针都将受到超级欢迎。 73秒C

1 个答案:

答案 0 :(得分:1)

如何将baseman导入为from mpl_toolkits.basemap import Basemap