简体   繁体   中英

Runtime error when importing basemap into spyder

I installed spyder onto my computer a few months ago and it has worked fine until I needed to produce a map with station plots and topography. I simply tried to import matplotlib-basemap and get the following error:

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'>

If anyone has gone through this or understands this type of error suggest a way to make basemap work on spyder?

( Spyder maintainer here ) This error was fixed in our 3.2.8 version, released in March/2018.

Since you're using Anaconda, please open the Anaconda prompt and run there

conda update spyder

to get the fix.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM