linux - WSL - GEDIT 无法初始化服务器 : Could not connect: Connection refused

标签 linux ubuntu windows-subsystem-for-linux gedit

关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。












我们不允许在 Stack Overflow 上提出有关通用计算硬件和软件的问题。您可以编辑问题,使其成为 on-topic对于堆栈溢出。


2年前关闭。







Improve this question




我在我的 Windows 10 机器上使用 Ubuntu 18.04 作为 Linux 的 Windows 子系统。
我已经安装了gedit没有任何错误或警告。

但是每当我尝试使用命令 gedit something (这里的东西是一个文件名)
我收到此错误:

Unable to init server: Could not connect: Connection refused

(gedit:48): Gtk-WARNING **: 21:03:26.729: cannot open display:

最佳答案

您需要 X 服务器来运行图形应用程序,如 gedit .
我用 VcXsrvXming在我的 Windows 桌面上,两者都非常小且易于安装,
但还有其他服务器,如 Cygwin/X .

VcXsrv/Xming 的简短说明:

  • 下载并安装 Windows 软件包
  • 启动 XLaunch 或 Xming
  • 在 WSL 终端中导出 DISPLAY 变量并启动 gedit
    export DISPLAY=0:0
    gedit
    

  • 我的问题是 gedit 首选项中的某些复选框不起作用(dconf 错误,我不在乎),但除此之外编辑器可用。

    有关的:
  • What's the easiest way to run GUI apps on Windows Subsystem for Linux as of 2018? (askubuntu.com)
  • 关于linux - WSL - GEDIT 无法初始化服务器 : Could not connect: Connection refused,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60284542/

    相关文章:

    bash - .bashrc 在 WSL 上的位置是什么?

    c++ - 如何在WSL 2中读取物理内存?

    linux - Bash 中的 Argc 和 Argv

    linux - 关于 bash 脚本中的系统时间

    ruby-on-rails - digital ocean 服务器上的 psql db 转储到本地计算机

    linux - 安装驱动程序会增加 linux 内核内存占用吗?

    docker - 让 docker build --memory-swap=20g 使用可用的交换空间?

    php - 通过 bash 在 linux 中生成一个完全独立的进程

    linux - 松鼠邮件数据副本

    node.js - ubuntu 12.10 上的平均堆栈安装失败