mac 安裝pip教程

pip是在python開發過程中必不可少的包管理工具,在Mac中,我們安裝首先想到brew

brew install pip

但這樣安裝會有問題:

Error: No available formula with the name "pip" 
pip is part of the python formula:
  brew install python

或更詳細一點,這樣:

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.org/en/stable/installing/#install-pip

所以用以下方法安裝

sudo easy_install 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
    
  • 腳本安裝

    $ curl -0 https://raw.github.com/pypa/pip/master/contrib/get-pip.py
    $ sudo python get-pip.py
    

這三者都可以,比較常用第一種。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章