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

2015-01-17 19:48:12 +08:00
 kisshere

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,请问该怎么办?

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

最后执行

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

表示安装成功!

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/163044

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX