pycharm中matplotlib不自动弹出画的图

平台:mac

问题描述:在pycharm用matplotlib作两个图但是只能显示一个图(在pycharm的sciview中),并且没有底下的tools栏目。

查了一下有人说在设置中取消在sciview中显示就可以了,然后取消勾选以后sicview不显示了,也并没有自动弹出画的图。

在命令行中用python画却能正常弹出。

————————————————————————————————————————————————

解决办法:

第一步:I assume you have installed the pip matplotlib, there is a directory in you root called ~/.matplotlib.

我的电脑上路径是这样的/Users/show_me_a_bit/Desktop/python_projects/venv/lib/python2.7/site-packages/matplotlib

找到这个路径。(路径是隐藏的,查看隐藏文件快捷键shift+command+.    取消显示隐藏文件快捷键相同)

第二步:Create a file ~/.matplotlib/matplotlibrc there and add the following code: backend: TkAgg

进入路径后在里边创建一个名为matplotlibrc的文件(无后缀名,可用命令行touch命令创建),打开发现里边自动有了内容,拉到最后加上一行:backend: TkAgg

——————————————————————————————————————————————————————————————————————————————

stack overflow链接

https://stackoverflow.com/questions/21784641/installation-issue-with-matplotlib-python

————————————————————————————————————————————————————————————————————————————

另外好像跟这个也有关:matplotlib.pyplot 中显示图像的两种模式(交互和阻塞)

链接:https://blog.csdn.net/wonengguwozai/article/details/79686062

猜你喜欢

转载自blog.csdn.net/qqq2018/article/details/82792073