当我在python 3.5上通过ssh在ipython中运行matplotlib.pyplot时,我收到此错误消息,我不知道该怎么做。
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分别重新安装所有软件包。有什么想法吗?
答案 0 :(得分:3)
对于那些将来遇到这种情况的人,我在OSX上遇到了一个没有实际登录系统的用户的这个错误。一个新用户被添加到OSX笔记本电脑,我ssh'd进入它,在ssh上安装matplotlib,然后尝试图形。系统检测到用户帐户从未通过GUI登录并杀死了Python。
我不确定操作系统究竟是什么导致Python崩溃,只是通过GUI登录该用户帐户(并按照用户帐户设置教程,我认为这是关键)解决了我的问题。