作者:mobiledu2502937927 | 来源:互联网 | 2023-07-19 10:21
这篇文章主要介绍怎么从Windows上运行任何Linux图形GUI程序,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!Windows10上的
这篇文章主要介绍怎么从Windows上运行任何Linux图形GUI程序,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
Windows10上的wsl模式虽然解决了运行linux程序的痛点,然而所运行的程序依然受困于Terminal中。比如emacs:
![怎么从Windows上运行任何Linux图形GUI程序](https://img1.php1.cn/3cd4a/24ed6/2be/11fd315ea623d8d0.png)
终端版本的emacs
试图获得赏心悦目的视觉效果,比如优美的字体和图形,必须设法取得GUI。
1.安装VcXsrv
首先用 choco 工具安装VcXsrv:
![怎么从Windows上运行任何Linux图形GUI程序](https://img1.php1.cn/3cd4a/24ed6/2be/99c78a7703b116d5.png)
PS C:\Users\gaowei> sudo choco install vcxsrc Chocolatey v0.10.15 Installing the following packages: vcxsrc By installing you accept licenses for the packages.
2.配置 bashrc 或者 zshrc 文件
在 .bashrc 或者 .zshrc 中添加 这两行代码:
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0 # in WSL 2 export LIBGL_ALWAYS_INDIRECT=1
3.初始化 VcXsrv
打开程序之后,首先选择 multiple windows:
![怎么从Windows上运行任何Linux图形GUI程序](https://img1.php1.cn/3cd4a/24ed6/2be/d7d18e3f2d12f9a9.png)
继续下一步, 选择 start no client:
![怎么从Windows上运行任何Linux图形GUI程序](https://img1.php1.cn/3cd4a/24ed6/2be/2865d35c46e1a261.jpeg)
下一步后,选择全部选项:
![怎么从Windows上运行任何Linux图形GUI程序](https://img1.php1.cn/3cd4a/24ed6/2be/b4338ded1fcd50b3.jpeg)
下一步则完成:
![怎么从Windows上运行任何Linux图形GUI程序](https://img1.php1.cn/3cd4a/24ed6/2be/ec4c159c57e81e51.png)
4.运行GUI程序:
比如马上运行图形版的emacs:
![怎么从Windows上运行任何Linux图形GUI程序](https://img1.php1.cn/3cd4a/24ed6/2be/e8bf964a75508441.png)
以上是“怎么从Windows上运行任何Linux图形GUI程序”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注编程笔记行业资讯频道!