[内容] pip 工具的安装 (MacBook Air 版)

内容一:安装 pip2

1.1 下载 pip2

$ curl 'https://bootstrap.pypa.io/pip/2.7/get-pip.py' > get-pip.py

1.2 安装 pip2

$ sudo python get-pip.py

1.3 删除 pip2

$ rm get-pip.py

1.4 显示安装的 pip2

1.4.1 显示在 python 里有没有 pip 安装包
$ ls /Library/Python/2.7/site-packages/

(补充:这里以 Python 版本是 2.7 为例)

1.4.2 显示有没有 pip2 命令
$ which pip2
1.4.3 升级 pip2
$ sudo pip2 install --upgrade pip

内容二:安装 pip3

2.1 准备安装 pip3 所需的环境

2.1.1 安装 python3
2.1.1.1 输入 python3 命令
$ python3
2.1.1.2 在弹出的对话框里安装 python3

(步骤略)

2.1.2 安装 xcode
2.1.2.1 输入 xcode-select –install 命令
$ xcode-select --install
2.1.2.2 在弹出的对话框里安装 xcode

(步骤略)

2.2 安装 pip3

2.2.1 下载 pip3
$ curl 'https://bootstrap.pypa.io/pip/get-pip.py' > get-pip.py
2.2.2 安装 pip3
$ sudo python get-pip.py
2.2.3 删除 pip3
$ rm get-pip.py
2.2.4 显示安装的 pip3
2.2.4.1 显示在 python 里有没有 pip 安装包
$ ls /Library/Python/3.8/site-packages/

(补充:这里以 Python 版本是 3.8 为例)

2.2.4.2 显示有没有 pip3 命令
$ which pip3
2.2.4.3 升级 pip3
$ sudo pip3 install --upgrade pip