V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
kisshere
V2EX  ›  问与答

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

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

    最后执行

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

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