gpt4 book ai didi

python-3.x - 如何解决 XStartTimeoutError : Failed to start X on display ":1013" error

转载 作者:行者123 更新时间:2023-12-04 01:36:04 32 4
gpt4 key购买 nike

我想在我的 Mac 上运行一个 pyvirtualdisplay。

安装所有依赖项后,我安装了 X11,因为
我需要运行 Xvfb 并将一些名为 ~/.Xauthority 的文件夹的权限更改为 777。

不过,如果我跑了

display = pyvirtualdisplay.Display(visible=0, size=(320, 240)).start()

XStartTimeoutError: Failed to start X on display ":1013" (xdpyinfo check failed).

我也尝试过改变
X11Forwarding 在我的/etc/ssh/sshd_config 文件中设置为 yes。
没有成功。

我该如何解决这个问题?

build 性的帮助表示赞赏。

最佳答案

我在 Raspberry Pi 上尝试使用 PyVirtualDisplay 运行 Selenium 时遇到了同样的错误。我没有运行 Xephyr。

在一个单独的终端窗口中,我跑了

export DISPLAY=:0 XAUTHORITY=/etc/X11/host-Xauthority

进而
Xephyr :1 -fullscreen

然后重新运行我的 python 脚本并且它起作用了。

如果这对你不起作用,这里是 PyVirtualDisplay 包中发生实际错误的地方: https://github.com/ponty/PyVirtualDisplay/blob/d229fcf892fdda17887684b977365d1fa90255eb/pyvirtualdisplay/abstractdisplay.py#L149

如您所见,您可能需要安装 xdpyinfo在 Mac 上以某种形式。

关于python-3.x - 如何解决 XStartTimeoutError : Failed to start X on display ":1013" error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57279989/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com