如何更改scrapy view命令使用的浏览器? [英] How do I change the browser used by the scrapy view command?

查看:48
本文介绍了如何更改scrapy view命令使用的浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改scrapy shell 中view(response) 命令使用的浏览器?它在我的机器上默认为 safari,但我希望它使用 chrome,因为 chrome 中的开发工具更好.

How do I change the browser used by the view(response) command in the scrapy shell? It defaults to safari on my machine but I'd like it to use chrome as the development tools in chrome are better.

推荐答案

正如 eLRuLL 已经提到的,view(response) 使用 webbrowser 打开你下载的网页.要更改其行为,您需要设置一个 BROWSER 环境变量.

As eLRuLL already mentioned, view(response) uses webbrowser to open the web page you downloaded. To change its behavior, you need to set a BROWSER environment variable.

您可以通过在 ~/.bashrc 文件末尾添加以下行来实现:export BROWSER=/usr/bin/firefox(如果你想使用 firefox).

You could do this by adding the following line at the end of your ~/.bashrc file: export BROWSER=/usr/bin/firefox (if you would like firefox to be used).

我没有安装 Chrome,但是通过在 Google 上快速搜索,它的路径似乎是 /usr/bin/google-chrome-stable;因此,您可以尝试 export BROWSER=/usr/bin/google-chrome-stable 代替.不过,我没有针对 Chrome 对其进行测试.

I don't have Chrome installed, but by doing a fast search on Google, it seems its path is /usr/bin/google-chrome-stable; therefore, you could try export BROWSER=/usr/bin/google-chrome-stable instead. I didn't test it for Chrome though.

这篇关于如何更改scrapy view命令使用的浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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