Python 官方文档:入门教程 => 点击学习
导入matplotlib包是出现各种错误,解决一个又出现一个。比如:module 'matplotlib' has no attribute 'get_data_path',No module named 'pyparsing', cann
导入matplotlib包是出现各种错误,解决一个又出现一个。比如:module 'matplotlib' has no attribute 'get_data_path',No module named 'pyparsing', cannot import name 'get_versions' from 'matplotlib._version'等等。在网上大多数都是重新安装matplotlib包,然而也没有解决。
这个错误可能是由于Matplotlib的版本不兼容导致的,与你python版本或者其他包(numpy,scipy)版本不兼容问题。
解决方法:
在终端Anaconda Prompt(切换到运行Python的环境下),激活环境。
删除numpy,scipy,matplotlib包(最好是按顺序)。
pip uninstall numpy,pip uninstall numpy,pip uninstall matplotlib
重新安装numpy,scipy,matplotlib包(最好是按顺序)
利用清华镜像:
pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install scipy -i Https://pypi.tuna.tsinghua.edu.cn/simple
pip install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple
最后重新导入matplotlib,导入成功!!!(花了我一小时导入)
来源地址:https://blog.csdn.net/m0_47809115/article/details/129753030
--结束END--
本文标题: 导入matplotlib包出现各种错误的解决方法
本文链接: https://www.lsjlt.com/news/400175.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0