我如何设置&在 Ubuntu 上运行 PhantomJS?

发布于 2024-12-25 19:50:19 字数 500 浏览 6 评论 0原文

我设置了 PhantomJS 并将其录制到视频中: https://www.dailymotion.com/video/xnizmh_1_webcam

构建说明: http://phantomjs.org/build.html

有什么吗我的设置有问题吗?

设置完成后,我阅读了 快速入门教程 并尝试编写此代码

phantomjs hello.js 

它给我“找不到命令”错误。我该如何解决这个问题?

I set up PhantomJS and recorded it to video: https://www.dailymotion.com/video/xnizmh_1_webcam

Build instructions: http://phantomjs.org/build.html

Is there anything wrong in my setup?

After I set it up I read the quick start tutorial and tried to write this code

phantomjs hello.js 

It gives me "command not found" error. How can I solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(25

永言不败 2025-01-01 19:50:19

吉杜伊的回答让我走上了正轨。我必须向 /usr/bin/ 添加一个额外的符号链接,并且我为所有 3 个符号链接做了直接符号链接 - 见下文。

我正在 Ubuntu 服务器 Natty Narwhal 上安装。

这正是我所做的。

cd /usr/local/share
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/bin/phantomjs

最后,当我这样做时,

phantomjs -v

我得到 1.9.7

如果有人发现我所做的有任何问题,请告诉我。

Guidouil's answer put me on the right track. I had to add one additional symlink to /usr/bin/, and I did direct symlinks for all 3 - see below.

I'm installing on Ubuntu server Natty Narwhal.

This is exactly what I did.

cd /usr/local/share
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/bin/phantomjs

And finally when I do

phantomjs -v

I get 1.9.7

If anyone sees any problems with what I've done, please let me know.

猥︴琐丶欲为 2025-01-01 19:50:19

PhantomJS 位于 npm 上。您可以运行此命令来全局安装它:

npm install -g phantomjs-prebuilt  

phantomjs -v 应返回2.1.1

PhantomJS is on npm. You can run this command to install it globally:

npm install -g phantomjs-prebuilt  

phantomjs -v should return 2.1.1

暗喜 2025-01-01 19:50:19

从 phantomjs 网站下载预构建包:
http://phantomjs.org/download.html
然后打开终端并转到下载文件夹,

sudo mv phantomjs-1.8.1-linux-x86_64.tar.bz2 /usr/local/share/.
cd /usr/local/share/
sudo tar xjf phantomjs-1.8.1-linux-x86_64.tar.bz2
sudo ln -s /usr/local/share/phantomjs-1.8.1-linux-x86_64 /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin/phantomjs

然后检查安装 phantomjs -v 是否应返回 1.8.1

download from phantomjs website the prebuilt package :
http://phantomjs.org/download.html
then open a terminal and go to the Downloads folder

sudo mv phantomjs-1.8.1-linux-x86_64.tar.bz2 /usr/local/share/.
cd /usr/local/share/
sudo tar xjf phantomjs-1.8.1-linux-x86_64.tar.bz2
sudo ln -s /usr/local/share/phantomjs-1.8.1-linux-x86_64 /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin/phantomjs

then to check install phantomjs -v should return 1.8.1

夜深人未静 2025-01-01 19:50:19

从包管理器安装:

sudo apt-get install phantomjs

Install from package manager:

sudo apt-get install phantomjs
知足的幸福 2025-01-01 19:50:19

以下是我使用的构建步骤(请注意,这些说明适用于版本 1.3。有关最新 PhantomJS 的安装说明,请参阅对此答案的评论):

sudo apt-get update
sudo apt-get install git-core
sudo apt-get install build-essential
sudo apt-get install libqt4-dev libqtwebkit-dev qt4-qmake
git clone git://github.com/ariya/phantomjs.git && cd phantomjs
git checkout 1.3
qmake-qt4 && make

现在安装 Xvfb

sudo apt-get install xvfb xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic

启动 Xvfb:
Xvfb :23 -screen 0 1024x768x24 &

现在运行 phantom:
DISPLAY=:23 ./phantomjs hello.js

Here are the build steps I used (note these instructions are for version 1.3. See comments to this answer for the installation instructions of the latest PhantomJS):

sudo apt-get update
sudo apt-get install git-core
sudo apt-get install build-essential
sudo apt-get install libqt4-dev libqtwebkit-dev qt4-qmake
git clone git://github.com/ariya/phantomjs.git && cd phantomjs
git checkout 1.3
qmake-qt4 && make

Now install Xvfb

sudo apt-get install xvfb xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic

Launch Xvfb:

Xvfb :23 -screen 0 1024x768x24 &

Now run phantom:

DISPLAY=:23 ./phantomjs hello.js

不乱于心 2025-01-01 19:50:19

对于 1.5 以上的 PhantomJS 版本,请考虑以下内容(phantom 网站上构建说明的逐字副本):

对于 Ubuntu Linux(在 Ubuntu 10.04 Lucid 的准系统安装上测试)
Lynx 和 Ubuntu 11.04 Natty Narwhal):

sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
git 克隆 git://github.com/ariya/phantomjs.git
cd幻影
git 结账 1.7
./build.sh

For PhantomJS version above 1.5, consider this (verbatim copy of the build instructions on the phantom website):

For Ubuntu Linux (tested on a barebone install of Ubuntu 10.04 Lucid
Lynx and Ubuntu 11.04 Natty Narwhal):

sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.7
./build.sh
探春 2025-01-01 19:50:19

对于 Ubuntu,您可以使用预构建版本可从 PhantomJS 站点下载

如果您有闲暇时间,也可以自己构建。 (这正是 Nikhil 的回答中的过程)。

PhantomJS 的人建议使用二进制文件来节省时间:

警告:从源代码编译 PhantomJS 需要很长时间,主要是由于 WebKit 模块中有数千个文件。在现代机器上有 4 个并行编译作业,整个过程大约需要 30 分钟。强烈建议下载并安装现成的二进制包(如果有)。

对于现代机器来说,他们的意思是> 4 核,>我认为是 8GB 内存。我在一个微型 AWS 实例上尝试过,2 小时后放弃了。

简而言之:按照 PhantomJS 站点的说明安装预构建的软件包。

For Ubuntu you can use the prebuilt versions downloadable from the PhantomJS site.

If you have some serious time on your hands you can also build it yourself. (This is exactly the procedure from Nikhil's answer).

The guys over at PhantomJS recommend using the binaries to save time:

Warning: Compiling PhantomJS from source takes a long time, mainly due to thousands of files in the WebKit module. With 4 parallel compile jobs on a modern machine, the entire process takes roughly 30 minutes. It is highly recommended to download and install the ready-made binary package if it is available.

With a modern machine they mean > 4 cores, > 8gb mem I think. I tried it on a micro AWS instance and gave up after 2 hours.

In short: install the prebuilt packages from the PhantomJS site per their instructions.

皓月长歌 2025-01-01 19:50:19

就我个人而言,我更喜欢使用 npm (请参阅 Arnel Bucio 答案

sudo npm install -g phantomjs

但是!我注意到一些 npm 模块仍然无法将其视为全局可执行文件。

在此处输入图像描述

所以!

  • 创建新的/usr/share/phantomjs/目录链接

    cd /usr/share
    sudo ln -s ../lib/node_modules/phantomjs/lib/phantom phantomjs
    
  • 删除旧的 /usr/bin/phantomjs 可执行链接并创建新的一个

    cd /usr/bin
    sudo mv phantomjs phantomjs.old
    sudo ln -s ../share/phantomjs 。
    

Personaly I prefer using npm (see Arnel Bucio answer)

sudo npm install -g phantomjs

but! I noticed that some of npm module still can't see it as global executable.

enter image description here

so!

  • Create new /usr/share/phantomjs/ directory link

    cd /usr/share
    sudo ln -s ../lib/node_modules/phantomjs/lib/phantom phantomjs
    
  • Remove old /usr/bin/phantomjs executable link and create the new one

    cd /usr/bin
    sudo mv phantomjs phantomjs.old
    sudo ln -s ../share/phantomjs .
    
箜明 2025-01-01 19:50:19

在我的流浪引导中:

apt-get install -y build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.9
echo y | ./build.sh
ln -s /home/vagrant/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
cd ..

in my vagrant bootstrap:

apt-get install -y build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.9
echo y | ./build.sh
ln -s /home/vagrant/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
cd ..
眉目亦如画i 2025-01-01 19:50:19

我已经完成了这个。

sudo apt-get update
sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.9
./build.sh

I have done with this.

sudo apt-get update
sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.9
./build.sh
混吃等死 2025-01-01 19:50:19

查看链接
安装指南位于...

https://gist.github.com/julionc/7476620

并使用此命令在终端中运行

phantomjs --webdriver=4444

See link
Installation guide is in ...

https://gist.github.com/julionc/7476620

And run in terminal with this command

phantomjs --webdriver=4444

病女 2025-01-01 19:50:19

来自官方网站:phantomjs 网站

sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.8
./build.sh

From the official site: phantomjs site

sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.8
./build.sh
鸵鸟症 2025-01-01 19:50:19

对于 Ubuntu,请从 http://phantomjs.org/download.html 下载合适的文件。 CD 到下载的文件夹。然后:

sudo tar xvf phantomjs-1.9.0-linux-x86_64.tar.bz2
sudo mv phantomjs-1.9.0-linux-x86_64 /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/bin/phantomjs

确保将这些命令中的文件名替换为您已下载的文件。

For Ubuntu, download the suitable file from http://phantomjs.org/download.html. CD to the downloaded folder. Then:

sudo tar xvf phantomjs-1.9.0-linux-x86_64.tar.bz2
sudo mv phantomjs-1.9.0-linux-x86_64 /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/bin/phantomjs

Make sure to replace the file name in these commands with the file you have downloaded.

︶葆Ⅱㄣ 2025-01-01 19:50:19

请注意,这绝对是一种方法:

$ sudo apt-get install phantomjs
$ phantomjs -v
1.6.0

遗憾的是,它安装的是 1.6,而不是最新的,但这适用于我的目的。

Be aware this is definitely one way to do it:

$ sudo apt-get install phantomjs
$ phantomjs -v
1.6.0

Sadly, it installs 1.6 and not the latest one, but this works for my purposes.

污味仙女 2025-01-01 19:50:19

我知道这太旧了,但是,如果现在有人从 Google 得到这个问题,你可以通过输入 apt-get install phantomjs 来安装它

I know this is too old, but, just i case someone gets to this question from Google now, you can install it by typing apt-get install phantomjs

何以畏孤独 2025-01-01 19:50:19

在 Windows 版 Ubuntu 上,我发现 apt-get 和 npm 版本都不适合我。有效的是此评论中的脚本。

为了便于使用,我将整个内容粘贴到名为 install_phantomjs.sh 的脚本文件中,使其可执行 (chmod u+x install_phantomjs.sh),然后运行它(./install_phantomjs.sh)

On Ubuntu for Windows, I found neither apt-get nor npm versions worked for me. What worked was the script from this comment.

For ease of use, I pasted the whole thing into a script file called install_phantomjs.sh, made it executable (chmod u+x install_phantomjs.sh), and then ran it (./install_phantomjs.sh)

夜雨飘雪 2025-01-01 19:50:19

或者最新的 - 32 位版本 Linux

sudo wget http://phantomjs.googlecode.com/files/phantomjs-1.9.2-linux-i686.tar.bz2

sudo ln -s /usr/local/share/phantomjs-1.9.2-linux-i686/bin/phantomjs /usr/local/share/phantomjs

sudo ln -s /usr/local/share/phantomjs-1.9.2-linux-i686/bin/phantomjs /usr/local/bin/phantomjs

sudo ln -s /usr/local/share/phantomjs-1.9.2-linux-i686/bin/phantomjs /usr/bin/phantomjs

Or the latest - 32bit version Linux

sudo wget http://phantomjs.googlecode.com/files/phantomjs-1.9.2-linux-i686.tar.bz2

sudo ln -s /usr/local/share/phantomjs-1.9.2-linux-i686/bin/phantomjs /usr/local/share/phantomjs

sudo ln -s /usr/local/share/phantomjs-1.9.2-linux-i686/bin/phantomjs /usr/local/bin/phantomjs

sudo ln -s /usr/local/share/phantomjs-1.9.2-linux-i686/bin/phantomjs /usr/bin/phantomjs
可遇━不可求 2025-01-01 19:50:19

安装和调用Phantomjs

按照步骤操作不行,但是克隆了由其他人建造。 (版本2.0)

Installation and Calling Phantomjs

Follow the steps doesn't work, but cloned from others built. (ver2.0)

鹿港小镇 2025-01-01 19:50:19

以下是 Julio Napurí 的安装过程 https://gist.github.com/julionc

版本:1.9.8

平台:x86_64

首先,安装或更新到最新的系统软件。

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev

安装 PhantomJS 所需的这些软件包才能正常工作。

sudo apt-get install libfreetype6 libfreetype6-dev
sudo apt-get install libfontconfig1 libfontconfig1-dev

从 PhantomJS 网站获取。

cd ~
export PHANTOM_JS="phantomjs-1.9.8-linux-x86_64"
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2

下载后,将 Phantomjs 文件夹移动到 /usr/local/share/ 并创建一个符号链接:

sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin

现在,它应该在您的系统上正确安装了 PhantomJS。

phantomjs --version

Bellow the installation procedure by Julio Napurí https://gist.github.com/julionc

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev

Install these packages needed by PhantomJS to work correctly.

sudo apt-get install libfreetype6 libfreetype6-dev
sudo apt-get install libfontconfig1 libfontconfig1-dev

Get it from the PhantomJS website.

cd ~
export PHANTOM_JS="phantomjs-1.9.8-linux-x86_64"
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2

Once downloaded, move Phantomjs folder to /usr/local/share/ and create a symlink:

sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin

Now, It should have PhantomJS properly on your system.

phantomjs --version
终止放荡 2025-01-01 19:50:19

我发现了这种更简单的方法 - Phantom dependency + Npm

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
sudo apt-get install libfreetype6 libfreetype6-dev
sudo apt-get install libfontconfig1 libfontconfig1-dev

和 npm

[sudo] npm install -g phantomjs

Done。

I have found this simpler way - Phantom dependencies + Npm

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
sudo apt-get install libfreetype6 libfreetype6-dev
sudo apt-get install libfontconfig1 libfontconfig1-dev

and npm

[sudo] npm install -g phantomjs

Done.

も星光 2025-01-01 19:50:19

在linux上运行hello.js不要忘记添加hello.js的路径:

phantomjs YourPathToPhantomjsFolder/examples/hello.js

On linux to run hello.js don't forget to add the path of hello.js:

phantomjs YourPathToPhantomjsFolder/examples/hello.js

梦初启 2025-01-01 19:50:19

如果你想轻松使用phantomjs,你可以在phantomjscloud.com使用它
只需通过http请求即可得到结果。

If you want to use phantomjs easily, you can use it at phantomjscloud.com
You can get the result just by http request.

许你一世情深 2025-01-01 19:50:19

这就是我将特定版本的 phantomjs 放置在 docker 容器的 /usr/local/bin 中的方法。

curl -Ls https://github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-linux-x86_64.tar.bz2 \
    | tar jxvf - --strip-components=2 -C /usr/local/bin/ ./phantomjs-1.9.8-linux-x86_64/bin/phantomjs

或不带 ./,具体取决于操作系统。

curl -Ls https://github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-linux-x86_64.tar.bz2 \
    | tar jxvf - --strip-components=2 -C /usr/local/bin/ phantomjs-1.9.8-linux-x86_64/bin/phantomjs

This is how I place a specific version of phantomjs in /usr/local/bin on my docker containers.

curl -Ls https://github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-linux-x86_64.tar.bz2 \
    | tar jxvf - --strip-components=2 -C /usr/local/bin/ ./phantomjs-1.9.8-linux-x86_64/bin/phantomjs

or with out ./ depending on OS.

curl -Ls https://github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-linux-x86_64.tar.bz2 \
    | tar jxvf - --strip-components=2 -C /usr/local/bin/ phantomjs-1.9.8-linux-x86_64/bin/phantomjs
烟沫凡尘 2025-01-01 19:50:19

您无需 sudonpm 即可启动并运行。只需下载解压添加到路径即可。

如果您有备份整个主文件夹的习惯(我强烈推荐),那么这还有一个轻松备份的额外优势。这也适用于任何版本的 Linux。

➤  cd ~
➤  wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
➤  mkdir phantomjs
➤  tar xjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C phantomjs
➤  echo 'export PATH="$PATH:$HOME/phantomjs/bin"' >> .profile
➤  source .profile
➤  phantomjs -v
2.1.1

缺点是:

  1. 您需要手动升级
  2. 其他用户将无权访问它。

您可以使用非常简单的 shell 脚本来安装/升级

#!/bin/sh
# install_phantomjs.sh $VERSION

$VERSION = $1
printf "Downloading PhantomJS $VERSION...\n"
wget "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$VERSION-linux-x86_64.tar.bz2"

printf "Extracting PhantomJS $VERSION to ~/phantomjs...\n"
mkdir ~/phantomjs
tar xjf phantomjs-$VERSION-linux-x86_64.tar.bz2 -C ~/phantomjs

printf "Done! Make sure $HOME/phantomjs/bin is in your path.\n"

或者在 Dockerfile 中

# Download and setup PhantomJS
ENV PHANTOMJS_VERSION 2.1.1
RUN curl -fSL "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2" -o /tmp/phantomjs.tar.bz2 && \
  mkdir ~/phantomjs && \
  tar xjf /tmp/phantomjs.tar.bz2 -C ~/phantomjs && \
  rm /tmp/phantomjs.tar.bz2
ENV PATH /home/$USERNAME/phantomjs/bin:$PATH

You can get up and running without sudo or npm. Simply download, extract, and add to path.

This has the added advantage of easy backup if you are in the habit of backing up your entire home folder which I highly recommend. This also works with any version of Linux.

➤  cd ~
➤  wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
➤  mkdir phantomjs
➤  tar xjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C phantomjs
➤  echo 'export PATH="$PATH:$HOME/phantomjs/bin"' >> .profile
➤  source .profile
➤  phantomjs -v
2.1.1

The disadvantages are:

  1. You will need to manually upgrade
  2. Other users will not have access to this.

You could use a very simple shell script for installing/upgrading

#!/bin/sh
# install_phantomjs.sh $VERSION

$VERSION = $1
printf "Downloading PhantomJS $VERSION...\n"
wget "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$VERSION-linux-x86_64.tar.bz2"

printf "Extracting PhantomJS $VERSION to ~/phantomjs...\n"
mkdir ~/phantomjs
tar xjf phantomjs-$VERSION-linux-x86_64.tar.bz2 -C ~/phantomjs

printf "Done! Make sure $HOME/phantomjs/bin is in your path.\n"

Or in a Dockerfile

# Download and setup PhantomJS
ENV PHANTOMJS_VERSION 2.1.1
RUN curl -fSL "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2" -o /tmp/phantomjs.tar.bz2 && \
  mkdir ~/phantomjs && \
  tar xjf /tmp/phantomjs.tar.bz2 -C ~/phantomjs && \
  rm /tmp/phantomjs.tar.bz2
ENV PATH /home/$USERNAME/phantomjs/bin:$PATH
安静被遗忘 2025-01-01 19:50:19

这就是我所做的
在我的 ubuntu 16.04 机器上

sudo apt-get update
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
sudo mv path/where/you/downloaded/phantomjs  /usr/bin

,最后当我这样做时,

phantomjs -v

我得到了 2.1.1

在查看了该线程的每个答案后, 。我认为这是在 ubuntu 中安装和运行 phantomjs 的最佳解决方案。

Here is what I did
on my ubuntu 16.04 machine

sudo apt-get update
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
sudo mv path/where/you/downloaded/phantomjs  /usr/bin

and finally when I do

phantomjs -v

I get 2.1.1

After going through every answer of this thread. I think this is the best solution for installing and running phantomjs in ubuntu.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文