zoukankan      html  css  js  c++  java
  • Ubuntu下phantomjs的安装

    1、安装

    ubuntu下面可以直接使用命令安装(不可用)

    sudo apt-get install phantomjs
    

     官方下载:

    # 官方网站:
    http://phantomjs.org/download.html 
    # 淘宝镜像:
    https://npm.taobao.org/mirrors/phantomjs 
    

     2、解压

    tar -xvf phantomjs-1.9.7-linux-i686.tar.bz2
    
    # 注:解压失败,出现一下错误时,先查看压缩包是什么类型 file phantomjs-1.9.7-linux-i686.tar.bz2 看是否是bzip2类型再解压
    # bzip2: (stdin) is not a bzip2 file.
    # tar: Child returned status 2
    # tar: Error is not recoverable: exiting now
    

    3、创建软链接到环境变量中。这样可以直接在shell中使用phantomjs命令:

    sudo ln -sf /usr/local/src/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
    # 其中的参数s表示为软链接,参数f表示强制。
    #(或)添加到系统常量:
    cp phantomjs /usr/local/bin
    

    4、查看是否安装成功:

     

    phantomjs –v
    

     

    出现版本号则为成功安装

     

     

     注意:

    phantomjs中截图无法生成原因是 phantomjs执行需要root权限

    sudo phantomjs hello.js

     phantomjs无法获取https网址的内容原因是因为ssl不安全,需设置

    phantomjs --ignore-ssl-errors=true --ssl-protocol=any loadspeed.js https://www.baidu.com 
  • 相关阅读:
    supervise 用来监控服务,自动启动
    tee -a /var/log/jd.log
    类的构造函数与析构函数的调用顺序
    c++之带默认形参值的函数
    zoj1001-A + B Problem
    zoj1037-Gridland
    cf499A-Watching a movie
    cf478B-Random Teams 【排列组合】
    C++版修真小说
    Python_12-线程编程
  • 原文地址:https://www.cnblogs.com/yekushi-Z/p/10874135.html
Copyright © 2011-2022 走看看