kisshere
V2EX  ›  问与答

安装 phantomjs 后输入 phantomjs --v 提示:-bash:phantomjs:command not found

  •  
  •   kisshere · Jan 17, 2015 · 6552 views
    This topic created in 4319 days ago, the information mentioned may be changed or developed.

    centos,按照网上的教程:

    sudo yum install gcc gcc-c++ make git openssl-devel freetype-devel fontconfig-devel
    git clone git://github.com/ariya/phantomjs.git
    cd phantomjs
    git checkout 1.9
    ./build.sh

    安装了一个多小时完成后输入phantomjs --v,显示-bash:phantomjs:command not found,请问该怎么办?

    9 replies  •  2017-03-04 13:35:50 +08:00
    wangxiyu191
    wangxiyu191
    Jan 17, 2015
    1
    phantomjs -v 或者 phantomjs --version
    kisshere
    kisshere
    OP
    Jan 17, 2015
    2
    @wangxiyu191 都不行啊,还是-bash:phantomjs:command not found
    binux
    binux
    Jan 17, 2015
    3
    install 了吗?
    kisshere
    kisshere
    OP
    Jan 17, 2015
    4
    @binux 你的意思是还要执行什么操作?谢谢
    binux
    binux
    Jan 17, 2015
    5
    @kisshere 比如 cp 到 /usr/local/bin,一般会有一个脚本,或者参数干这个
    wangxiyu191
    wangxiyu191
    Jan 18, 2015
    6
    @kisshere
    @binux
    好吧我眼拙了,你这个phantomjs只是编译好了而已,得加进PATH才能直接用phantomjs运行。
    其实你可以直接下载二进制文件的。
    9hills
    9hills
    Jan 18, 2015
    7
    1. 编译了没有安装,就好比你用VS编了个软件,然后问桌面上为啥找不到呢
    2. 官网直接提供二进制下载:
    http://phantomjs.org/download.html
    9hills
    9hills
    Jan 18, 2015
    8
    不过这货也不用安装,直接本地运行就行。找到编译的目标文件夹。 ./phantomjs
    ifyour
    ifyour
    Mar 4, 2017
    9
    亲测完美解决:
    到[这里]( http://phantomjs.org/download.html )下载你对象系统的 phantomjs 文件,然后把 bin 目录的程序,放到当前系统的环境变量中.

    最后执行

    ```bash
    $ phantomjs -version
    v2.1.1
    ```

    表示安装成功!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1761 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 05:37 · PVG 13:37 · LAX 21:37 · JFK 00:37
    ♥ Do have faith in what you're doing.