如何从Windows上运行任何Linux图形GUI程序?

系统 Linux
Windows10上的wsl模式虽然解决了运行linux程序的痛点,然而所运行的程序依然受困于Terminal中。

[[373405]]

 Windows10上的wsl模式虽然解决了运行linux程序的痛点,然而所运行的程序依然受困于Terminal中。比如emacs:

如何从Windows上运行任何Linux图形GUI程序?

终端版本的emacs

试图获得赏心悦目的视觉效果,比如优美的字体和图形,必须设法取得GUI。

1.安装VcXsrv

首先用 choco 工具安装VcXsrv:


  1. PS C:\Users\gaowei> sudo choco install vcxsrc 
  2. Chocolatey v0.10.15 
  3. Installing the following packages: 
  4. vcxsrc 
  5. By installing you accept licenses for the packages. 

 2.配置 bashrc 或者 zshrc 文件

在 .bashrc 或者 .zshrc 中添加 这两行代码:

  1. export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0 # in WSL 2 
  2. export LIBGL_ALWAYS_INDIRECT=1 

 3.初始化 VcXsrv

打开程序之后,首先选择 multiple windows:

如何从Windows上运行任何Linux图形GUI程序?

继续下一步, 选择 start no client:

如何从Windows上运行任何Linux图形GUI程序?

 下一步后,选择全部选项: 

如何从Windows上运行任何Linux图形GUI程序?

下一步则完成:

如何从Windows上运行任何Linux图形GUI程序?

4.运行GUI程序:

比如马上运行图形版的emacs:

如何从Windows上运行任何Linux图形GUI程序?

如此,工作便如虎添翼,兼容并蓄Linux与Windows的双重优势。

 

责任编辑:姜华 来源: 今日头条
相关推荐

2016-02-16 09:36:37

CrossOverLinuxWindows

2016-08-02 10:34:17

LinuxWindows双启动

2021-06-02 09:45:21

WSLgWindows 10Linux

2017-09-18 10:05:15

WindowsLinux容器

2013-08-28 15:50:36

Linux桌面Mac

2011-08-31 09:40:25

VMwareWindows

2022-06-30 13:54:16

BottlesLinuxWindows

2022-07-23 13:31:25

PuTTY开源Linux

2021-05-26 13:34:21

Windows 10Linux GUI应用程序

2015-08-03 10:04:59

WineLinuxWindows

2021-07-15 17:50:34

Windows 365云服务微软

2021-10-21 07:08:02

Windows 11操作系统微软

2021-03-09 11:09:10

LinuxWindows应用程序

2022-01-21 09:18:49

Wine 7.0LinuxWindows

2020-08-28 07:00:00

WSLLinuxWindows 10

2017-02-16 10:15:43

Windows7docker变量

2021-02-25 08:00:00

WindowsWindows 10开发

2020-02-05 08:00:00

LinuxMacOSWindows

2012-05-24 09:47:26

ibmdw

2012-05-28 16:20:44

Linux
点赞
收藏

51CTO技术栈公众号