shaoheshaohe 发表于 2019-5-18 19:05:48

matplotlib.pyplot import MACos报错 解决方法

在python里,使用matplotlib.pyplot之前先执行以下两行代码:In : import matplotlibIn : matplotlib.use("TkAgg")
然后再导入,import matplotlib.pyplot as plt


另一种方法也记录如下:从stackoverflow上面找到的解决办法,现记录一下
1. cd ~/.matplotlib2. nano matplotlibbrc
3. 在打开的文件里加一行: backend : TkAggnano编辑器的使用:ctrl + x 保存退出, y确认保存,回车退出


报错信息:mac系统,安装了matplotlib之后, 导入matplotlib.pyplot的时候报错RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly
if Python is not installed as a framework. See the Python documentation for more information on installing Python as a
framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda
please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ
for more information.

页: [1]
查看完整版本: matplotlib.pyplot import MACos报错 解决方法