gpt4 book ai didi

selenium - 如何在 Scrapinghub 上安装 xvfb 以使用 Selenium?

转载 作者:行者123 更新时间:2023-12-03 06:22:39 26 4
gpt4 key购买 nike

我在我的蜘蛛(Scrapy)中使用Python-Selenium,为了使用Selenium,我应该在Scrapinghub上安装xvfb。

当我使用apt-get安装xvfb时,我收到此错误消息:

E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)                                                                                                                                                                
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

还有其他方法可以在Scrapinghub上安装xvfb吗?

更新1

我读到this ,我尝试使用docker,我卡在这个阶段

shub-image init --requirements path/to/requirements.txt

我读过这篇文章

If you are getting an ImportError like this while running shub-image init: You should make sure you have the latest version of shub installed by running:

$ pip install shub --upgrade

但我总是遇到这个错误

Traceback (most recent call last):
File "/usr/local/bin/shub-image", line 7, in <module>
from shub_image.tool import cli
File "/usr/local/lib/python2.7/dist-packages/shub_image/tool.py", line 42, in <module>
command_module = importlib.import_module(module_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/shub_image/push.py", line 4, in <module>
from shub.deploy import list_targets
ImportError: cannot import name list_targets

最佳答案

你尝试过吗:

sudo apt-get install xvfb

另一种方法是手动编译包,一种:

apt-get source xvfb
./configure --prefix=$HOME/myapps
make
make install

第三种方法是从源网页https://pkgs.org/download/xvfb下载.deb。

下载后,您可以将其mv到下载源的路径:

mv xvfb_1.16.4-1_amd64.deb /var/cache/apt/archives/

然后更改目录并执行以下操作:

sudo dpkg -i xvfb_1.16.4-1_amd64.deb

仅此而已!

关于selenium - 如何在 Scrapinghub 上安装 xvfb 以使用 Selenium?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44461359/

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