V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
kisshere
V2EX  ›  问与答

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

  •  
  •   kisshere · 2015-01-17 19:48:12 +08:00 · 5733 次点击
    这是一个创建于 3358 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    最后执行

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

    表示安装成功!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2850 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 15:20 · PVG 23:20 · LAX 08:20 · JFK 11:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.