问题
I have trouble importing the basemap module of mpl_toolkits in python. I've got following error message when I try to run "from mpl_toolkits.basemap import Basemap":
ModuleNotFoundError: No module named 'mpl_toolkits.basemap'
I'm using python 3.6.5 in windows.
I've found relevant Q&A in "Python basemap module impossible to import" and I already followed what's instructed there (i.e. source activate MyProfileName, conda install basemap) but it didn't work.
The clue might already be given in the Q&A above but as I'm quite new to python, I couldn't figure out the solution.
回答1:
I would recommend installing Anaconda environment from scratch. Let Anaconda handle dependencies for you. Then you need to install mpl_toolkits
separately in your conda environment with:
conda install -c conda-forge basemap-data-hires
See also here.
After doing this, executing
from mpl_toolkits.basemap import Basemap
from python console should work normally.
来源:https://stackoverflow.com/questions/52356192/modulenotfounderror-no-module-named-mpl-toolkits-basemap