通过 ssh 遇到 matplotlib.pyplot 问题 [英] Having issues with matplotlib.pyplot over ssh

查看:102
本文介绍了通过 ssh 遇到 matplotlib.pyplot 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通过ssh在python 3.5上的ipython中的matplotlib.pyplot中运行时,我收到此错误消息,并且不确定如何处理.

When I run matplotlib.pyplot in ipython on python 3.5 over ssh, I get this error message, and I'm not sure what to make of it.

In [1]: import matplotlib

In [2]: from matplotlib import pyplot
Jan 13 10:24:14  python[66770] <Error>: Set a breakpoint at CGSLogError to                catch errors as they are logged.
Jan 13 10:24:14  python[66770] <Error>: This user is not allowed access to the     window system right now.
_RegisterApplication(), FAILED TO establish the default connection to the     WindowServer, _CGSDefaultConnection() is NULL.
Jan 13 10:24:15  python[66770] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Jan 13 10:24:15  python[66770] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Jan 13 10:24:15  python[66770] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Jan 13 10:24:15  python[66770] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Jan 13 10:24:15  python[66770] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Jan 13 10:24:15  python[66770] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Jan 13 10:24:15  python[66770] <Warning>: Invalid Connection ID 0

我尝试通过anaconda完全重新安装python,并使用pip3 install单独安装所有软件包.有什么想法吗?

I have tried reinstalling python completely via anaconda and all the packages separately using pip3 install. Any thoughts?

推荐答案

对于那些将来遇到此问题的人,我是在OSX上遇到这个错误的,而该用户实际上没有登录到他们的系统中.一个新用户被添加到 OSX 笔记本电脑,我 ssh 进入它,通过 ssh 安装 matplotlib,然后尝试绘制图形.系统检测到用户帐户从未通过 GUI 登录过并杀死了 Python.

For those who run across this in the future, I was getting this bug on OSX with a user who hadn't actually logged into their system. A new user was added to an OSX laptop, I ssh'd into it, installed matplotlib over ssh, then tried to graph. The system detected that the user account had never been logged into via the GUI and killed Python.

我不确定操作系统中到底是什么导致 Python 崩溃,但只需通过 GUI 登录该用户帐户(并遵循我认为很关键的用户帐户设置教程)就为我解决了问题.

I'm not sure what exactly in the OS was crashing Python, but simply logging into that user account via the GUI (and following the user account setup tutorial, which I think is key) solved the problem for me.

这篇关于通过 ssh 遇到 matplotlib.pyplot 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆