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
    

这三者都可以,比较常用第一种。

猜你喜欢

转载自blog.csdn.net/quanqxj/article/details/89361600