mac下安装python pip、pyspider

如果mac下没有安装wget,还需要安装wget,见http://www.cnblogs.com/cocowool/archive/2012/06/24/2560574.html

使用 pip 安装 Python 库。pip 是 Python 的包管理工具,安装后就可以直接在命令行一站式地安装/管理各种库了(pip 文档)。

$ wget http://pypi.python.org/packages/source/p/pip/pip-0.7.2.tar.gz
$ tar xzf pip-0.7.2.tar.gz
$ cd pip-0.7.2
$ python setup.py install

然后安装pyspider,出现如下的提示:

yemadeMacBook-Pro:pip-0.7.2 zhaoliang$ pip install pyspider
-bash: pip: command not found

提示需要下载官方的command line,然后安装command line的时候,又提示:

yemadeMacBook-Pro:pip-0.7.2 zhaoliang$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

必須官方工具下載最新版 Command Line,  下载地址https://developer.apple.com/downloads/index.action?name=for%20Xcode%20

技术分享

注意这里需要对应好mac的版本号。安装完毕之后再次执行pip install pyspider就不会有问题了。(注意这里,如果网速不行会出现多次安装不成功)。

运行

运行很简单,只需要在命令行下输入pyspider,完成之后访问http://localhost:5000即可。

猜你喜欢

转载自jatter.iteye.com/blog/2310611