【pycharm远程python控制台】:“无法连接到X服务器";导入 pandas 时出错 [英] [pycharm remote python console]: "cannot connect to X server" error with import pandas

查看:66
本文介绍了【pycharm远程python控制台】:“无法连接到X服务器";导入 pandas 时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为 PyCharm 配置了一个远程 python 解释器并连接了 SSH 凭据.整个设置工作正常,除非我尝试导入任何使用 Qt 的 python 库,例如 pandas 或 matplotlib.

I configured a remote python interpreter for PyCharm and connected with SSH credentials. The whole setup works fine, except when I try to import any python library which uses Qt, such as pandas or matplotlib.

我放了一张带有此错误的远程 python 控制台的屏幕截图.当我单独 ssh 进入远程系统时,相同的导入命令工作正常.

I put a screenshot of the remote python console with this error. When I separately ssh into the remote system the same import commands work fine.

我在远程服务器上使用 Anaconda 来安装所有 python 库.我检查了 pyqt 也安装了.

I am using Anaconda on the remote server to install all python libraries. I checked the pyqt is installed too.

谁能帮我解决这个问题?

Can anyone help me figure this out?

推荐答案

有效的是,我在远程系统中安装了一个 GUI.然后安装 vnc 并通过运行 vncserver 对其进行配置.这给出了一个显示编号,比如 5.0.然后我将 PyCharm 中的环境变量放在项目设置中的 DISPLAY=:5.0 中.那行得通,任何绘图命令都会转到该显示,我可以使用 vnc 客户端查看.

what worked is, I installed a GUI in the remote system. Then installed vnc and configured it by running vncserver. Which gives a display number, say 5.0. I then put the environment variable in PyCharm to DISPLAY=:5.0 in the project settings. That worked, and any plot command goes to that display, which I can view with vnc client.

仍然有一个错误:Xlib: extension "RANDR" missing on display ":5.0" 但正如@Hamish Moffatt 所提到的,它可以被忽略.

There is still an error: Xlib: extension "RANDR" missing on display ":5.0" But as mentioned by @Hamish Moffatt, it can be ignored.

这篇关于【pycharm远程python控制台】:“无法连接到X服务器";导入 pandas 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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