如何在 R Studio 中安装 PhantomJS?

Jiu*_*Lin 5 r phantomjs

我写了一个需要运行的程序,下面是我的R代码:

library(webshot)

webshot("tmp.html","Normal_top100.png", delay =10, vwidth = 1920, vheight=1080) 
Run Code Online (Sandbox Code Playgroud)

但是,我收到以下消息:

PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.

因此,我需要安装 Phantomjs,但我遇到了一些无法解决的问题。

看到下面的链接安装了,但是不知道为什么还是不能成功运行。

https://www.jianshu.com/p/a7fd378714eb

网站说需要设置环境变量,我就用了这个链接的方法。但是,当我再次运行此代码时,仍然出现相同的错误。我怀疑原因是这个网站不正确。

谁能帮我?谢谢。

小智 4

要安装 phantomJS,您只需在 R 控制台中运行以下命令:

webshot::install_phantomjs()
Run Code Online (Sandbox Code Playgroud)

它将被下载并安装到您的默认库目录中。

有关更多详细信息,请阅读文档: https://rdrr.io/cran/webshot/man/install_phantomjs.html