QStandardPaths: XDG_RUNTIME_DIR 未设置,默认为 '/tmp/runtime-aadithyasb' [英] QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-aadithyasb'
问题描述
我在 Windows 10 中使用 WSL.我在运行 python 文件时显示此警告:
I am using WSL in Windows 10. I have this warning getting displayed when I run a python file:
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-aadithyasb'
我可以理解 XDG_RUNTIME_DIR
环境变量没有设置,它正在创建自己的路径 /tmp/runtime-aadithyasb
I can understand that the XDG_RUNTIME_DIR
environment variable is not set and it is creating its own path /tmp/runtime-aadithyasb
从我使用 VcXsrv 为 Windows 安装 Xserver 以在运行文件时打开绘图的那一刻起,我就收到了此警告.
I am getting this warning from the moment I installed Xserver for Windows using VcXsrv to open plots when the file is ran.
Wy 问题是我应该在 Windows 中添加这个 XDG_RUNTIME_DIR
环境变量还是有任何方法可以在 WSL 下使用的 Ubuntu 变量下设置目录?
Wy question is should I add this XDG_RUNTIME_DIR
environment variable in windows or is there any method to set a directory under the variable for Ubuntu used under WSL?
推荐答案
我能够找到导致终端发出警告的原因.然而,我发布了这篇文章,以便它对有一天像我这样刚开始使用 WSL 的人有用.这个链接帮助我解决了这个问题,让我更好地了解了 linux 在 WSL 下的工作方式:
I was able to find what the caused the terminal to issue the warning. Yet I am posting this so that it would be useful for people someday who are new to using WSL like me. This link helped me to solve it and gave me a better insight on how linux works under a WSL:
https://dev.to/winebaths/getting-up-and-running-with-the-windows-subsystem-for-linux-8oc
为了解决这个问题,我只是在我的 .bashrc
文件中添加了以下几行:
To solve this issue I just added the below lines to my .bashrc
file:
export XDG_RUNTIME_DIR=/some/directory/you/specify
export RUNLEVEL=3
在此之后只需运行命令
source .bashrc
现在警告不会一直显示在您的终端中.
Now the warning will not keep displaying in your terminal.
这篇关于QStandardPaths: XDG_RUNTIME_DIR 未设置,默认为 '/tmp/runtime-aadithyasb'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!