将底图导入spyder时出现运行时错误

Runtime error when importing basemap into spyder

我几个月前在我的电脑上安装了 spyder,它一直运行良好,直到我需要制作一张包含站点图和地形图的地图。我只是尝试导入 matplotlib-basemap 并得到以下错误:

File "<ipython-input-12-6634632f8d36>", line 1, in runfile('C:/Users/Isa/Documents/Freedman/2018/ENVIROCOMP/Stationplots.py', wdir='C:/Users/Isa/Documents/Freedman/2018/ENVIROCOMP')

File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile execfile(filename, namespace)

File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/Isa/Documents/Freedman/2018/ENVIROCOMP/Stationplots.py", line 15, in from mpl_toolkits.basemap import Basemap, shiftgrid, cm

File "<frozen importlib._bootstrap>", line 971, in _find_and_load

File "<frozen importlib._bootstrap>", line 951, in _find_and_load_unlocked

File "<frozen importlib._bootstrap>", line 890, in _find_spec

File "<frozen importlib._bootstrap>", line 864, in _find_spec_legacy

File "C:\ProgramData\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 253, in find_module fp, pathname, (ext,mode,ty) = imp.find_module(fullname,package_path)

File "C:\ProgramData\Anaconda3\lib\imp.py", line 271, in find_module "not {}".format(type(path)))

RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>

如果有人经历过这个或理解这种类型的错误,请提出一种使底图在 spyder 上工作的方法?

(这里是 Spyder 维护者) 这个错误在我们的 3.2.8 版本中修复了,March/2018 发布了。

由于您使用的是 Anaconda,请打开 Anaconda 提示符 运行

conda update spyder

获取修复。