安装和配置 xvfb [英] Installing and Configuring xvfb

查看:54
本文介绍了安装和配置 xvfb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试寻找兼容的 Ubuntu 操作系统、xorg 版本和 xvfb 版本.任何人都可以帮助我指导安装 xvfb 而不会挂机初始化内置扩展 GLX

I'm trying to find a Ubuntu operating system, version of xorg, and version of xvfb that are compatible. Can anyone help me with directions to install xvfb without getting a hang on Initializing build-in extension GLX

到目前为止,我已经尝试了以下

So far I've tried the following

Ubuntu 13 Server(No graphics card)
sudo apt-get install xorg 
sudo apt-get install xvfb
sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic

我运行命令 xvfb :10 它挂在

I run the command xvfb :10 and it hangs on

Initializing build-in extension GLX

是否有可以下载的特定版本或兼容的操作系统?

Are there specific versions I could download that will work or a operating system that would be compatible?

推荐答案

安装 Xvfb 或 Xephyr 或 Xvnc.还要安装 pyvirtualdisplay python 模块.这适用于 Ubuntu 14.04,也在 16.04 上进行了测试.

Install Xvfb or Xephyr or Xvnc. Also install pyvirtualdisplay python module. This is for Ubuntu 14.04 and tested on 16.04 as well.

sudo apt-get install python-pip
sudo apt-get install xvfb xserver-xephyr vnc4server
sudo pip install pyvirtualdisplay
# optional
sudo apt-get install python-pil scrot
sudo pip install pyscreenshot

现在您可以从您的 Python 脚本启动 Xvfb.当您的脚本执行时,它将启动 Xvfb.将以下行添加到您的代码中.

Now you can start Xvfb from your python script. It will start Xvfb when your script will be executed. Add the following lines to your code.

from pyvirtualdisplay import Display
display = Display(visible=0, size=(1366, 768))
display.start()

这是示例代码.

from pyvirtualdisplay import Display
from selenium import webdriver

display = Display(visible=0, size=(1366, 768))
display.start()
browser = webdriver.Firefox()
browser.get('http://www.google.com')
print browser.title
browser.quit()

display.stop()

这篇关于安装和配置 xvfb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆