【问题标题】:PyCharm Startup Error: Unable to detect graphics environment on Windows Subsystem for Linux (WSL) UbuntuPyCharm 启动错误:无法检测 Windows Subsystem for Linux (WSL) Ubuntu 上的图形环境
【发布时间】:2021-02-23 05:58:26
【问题描述】:
我正在尝试使用 Ubuntu 在适用于 Linux (WSL) 的 Windows 子系统上设置 PyCharm 社区。尝试运行它时 (sh bin/pycharm.sh) 我收到以下错误:
PyCharm 启动错误:无法检测图形环境
基于this 的帖子,我设置了export DISPLAY=:0 并以非root 身份尝试过,但没有成功。我不想为 Windows 安装 PyCharm,因为我需要使用 WSL 中的虚拟环境。我也无法安装本机 Ubuntu 或使用虚拟机。
【问题讨论】:
标签:
windows
ubuntu
pycharm
windows-subsystem-for-linux
【解决方案1】:
问题是WSL无法将PyCharm的图形环境输出到Windows。我已经通过导出DISPLAY=localhost:0.0 解决了这个问题,即运行:
echo 'export DISPLAY=localhost:0.0' >> ~/.bashrc
然后我必须安装 MobaXTerm,从 MobaXTerm 终端内启动 WSL,然后从那里运行 pycharm.sh。