Traceback (most recent call last):
File "xxx.py", line 39, in <module> import matplotlib.pyplot as plt # to plot File "C:\ProgramData\Anaconda3\envs\xxxx\__init__.py", line 122, in <module> from matplotlib.cbook import is_string_like, ImportError: cannot import name 'is_string_like'
解决办法:
查看自己命名的文件名,与导入的库文件名是否重复
因为,在Anaconda环境下,安装命令尽量使用 conda install matplotlib,
如果同时使用pip install matplotlib,然后在使用conda install matplotlib ,便会报出以上错位。
如果报出以上错误,建议使用
pip uninstall matplotlib
conda uninstall matplotlib
卸载干净之后,重新:
conda install matplotlib
再次打开spyder,运行成功!