easyprocess.EasyProcessCheckInstalledError: cmd=['Xvfb', '-help'] OSError=[Errno 2] No such file or directory

easyprocess.EasyProcessCheckInstalledError: cmd=['Xvfb', '-help'] OSError=[Errno 2] No such file or directory

我正在尝试设置显示,但它告诉我 No such file or directory

Traceback (most recent call last):
  File "/var/www/envs/venv/proj/scripts/my_file.py", line 44, in click
    display = Display(visible=0, size=(800,600))
  File "/usr/lib/python2.6/site-packages/pyvirtualdisplay/display.py", line 33, in __init__
    self._obj = self.display_class(
  File "/usr/lib/python2.6/site-packages/pyvirtualdisplay/display.py", line 51, in display_class
    cls.check_installed()
  File "/usr/lib/python2.6/site-packages/pyvirtualdisplay/xvfb.py", line 38, in check_installed
    ubuntu_package=PACKAGE).check_installed()
  File "/usr/lib/python2.6/site-packages/easyprocess/__init__.py", line 209, in check_installed
    raise EasyProcessCheckInstalledError(self)
easyprocess.EasyProcessCheckInstalledError: cmd=['Xvfb', '-help']
OSError=[Errno 2] No such file or directory
Program install error!

您可能需要安装 xvfb 软件包,或者 xvfbwrapper:

首先查看是否安装了xvfb:

Xvfb -help

如果命令 未找到 那么您通常可以使用以下命令(或您通常使用的任何包管理器)安装 xvfb 包:

sudo apt-get install xvfb

xvfbwrapper 是 Python X 虚拟帧缓冲区 (Xvfb) 内显示的 运行 包装器。

您可以安装它:

pip install xvfbwrapper

您遇到的错误似乎是找不到命令或模块的结果。

我在 Mac 上遇到了这个错误并且(最终)通过安装 Xquartz 解决了它:https://www.xquartz.org/(安装后重启!)