Mac 下安裝pip

weixin_33935777發表於2017-08-30

pip是python的包管理工具,準備寫爬蟲所以安裝下。

Step1.brew install pip(不能下載)

Updating Homebrew...

==> Auto-updated Homebrew!

Updated 1 tap (homebrew/core).

==> Updated Formulae

couchdb                      dcos-cli                      fobis                        kube-aws                      libpng                        m-cli                        mmark                        thefuck                      vips

Error: Could not link:

/usr/local/share/doc/homebrew

Please delete these paths and run `brew update`.

==> Migrating HOMEBREW_REPOSITORY (please wait)...

Error: /usr/local/Homebrew already exists.

Please remove it manually or uninstall and reinstall Homebrew into a new

location as the migration cannot be done automatically.

Error: No available formula with the name "pip"

Homebrew provides pip via: `brew install python`. However you will then

have two Pythons installed on your Mac, so alternatively you can install

pip via the instructions at:

https://pip.readthedocs.io/en/stable/installing/

可以看出pip是跟著python一起安裝的。


Step2.使用easy_install 安裝pip

由於我當前的python版本是mac自帶的2.7.10,所以找到easy_install 安裝pip:

sudo python /usr/bin/easy_install-2.7 pip