Mac 安装 pip 看这里就够了,pip、pip2、pip3 再也不懵了

啥是 pip ?

pip is the package installer for Python.
You can use it to install packages from the Python Package Index and other indexes.

pip 是 Python 包的安装程序。 您可以使用它从 Python 包索引和其他索引安装 Python 包。

零、基础准备

  • 官网

    • https://pip.pypa.io
  • 安装指引
    • https://pip.pypa.io/en/stable/installation

一、 安装方式

官方提供两种安装 pip 的方式

  • 方式一

    • ensurepip
  • 方式二
    • get-pip.py

我这里采用方式一ensurepip的方式安装。

二、 pip | pip2 安装

前置条件

  • 安装python2
$ python -V
Python 2.7.18

开始安装

$ python -m ensurepip --upgrade
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Looking in links: /var/folders/hq/9rdkq_5j7cz_25s2lqntqhwr0000gn/T/tmpSjRLxi
Requirement already up-to-date: setuptools in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (41.2.0)
Collecting pip

安装后查看版本号

安装完 pip(pip2) 后重新打开一个终端

$ pip -V
pip 19.2.3 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip (python 2.7)

安装后查看帮助命令

安装完 pip(pip2) 后重新打开一个终端

$ pip -hUsage:   pip <command> [options]Commands:install                     Install packages.download                    Download packages.uninstall                   Uninstall packages.freeze                      Output installed packages in requirements format.list                        List installed packages.show                        Show information about installed packages.check                       Verify installed packages have compatible dependencies.config                      Manage local and global configuration.search                      Search PyPI for packages.wheel                       Build wheels from your requirements.hash                        Compute hashes of package archives.completion                  A helper command used for command completion.debug                       Show information useful for debugging.help                        Show help for commands.General Options:-h, --help                  Show help.--isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.-v, --verbose               Give more output. Option is additive, and can be used up to 3 times.-V, --version               Show version and exit.-q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).--log <path>                Path to a verbose appending log.--proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.--retries <retries>         Maximum number of retries each connection should attempt (default 5 times).--timeout <sec>             Set the socket timeout (default 15 seconds).--exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.--trusted-host <hostname>   Mark this host as trusted, even though it does not have valid or any HTTPS.--cert <path>               Path to alternate CA bundle.--client-cert <path>        Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.--cache-dir <dir>           Store the cache data in <dir>.--no-cache-dir              Disable the cache.--disable-pip-version-checkDon't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.--no-color                  Suppress colored output

三、 pip3 安装

前置条件

  • 安装python3
$ python3 -V
Python 3.6.8

开始安装

$ python3 -m ensurepip --upgrade
Looking in links: /var/folders/hq/9rdkq_5j7cz_25s2lqntqhwr0000gn/T/tmp42dowxpt
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (63.2.0)
Processing /private/var/folders/hq/9rdkq_5j7cz_25s2lqntqhwr0000gn/T/tmp42dowxpt/pip-22.2.1-py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-22.2.1

安装后查看版本号

安装完 pip3 后重新打开一个终端

$ pip3 -V
pip 22.2.1 from /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip (python 3.10)

安装后查看帮助命令

安装完 pip 后重新打开一个终端

$ pip3 -hUsage:   pip3 <command> [options]Commands:install                     Install packages.download                    Download packages.uninstall                   Uninstall packages.freeze                      Output installed packages in requirements format.inspect                     Inspect the python environment.list                        List installed packages.show                        Show information about installed packages.check                       Verify installed packages have compatible dependencies.config                      Manage local and global configuration.search                      Search PyPI for packages.cache                       Inspect and manage pip's wheel cache.index                       Inspect information available from package indexes.wheel                       Build wheels from your requirements.hash                        Compute hashes of package archives.completion                  A helper command used for command completion.debug                       Show information useful for debugging.help                        Show help for commands.General Options:-h, --help                  Show help.--debug                     Let unhandled exceptions propagate outside the main subroutine, instead of logging them to stderr.--isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.--require-virtualenv        Allow pip to only run in a virtual environment; exit with an error otherwise.-v, --verbose               Give more output. Option is additive, and can be used up to 3 times.-V, --version               Show version and exit.-q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).--log <path>                Path to a verbose appending log.--no-input                  Disable prompting for input.--proxy <proxy>             Specify a proxy in the form scheme://[user:passwd@]proxy.server:port.--retries <retries>         Maximum number of retries each connection should attempt (default 5 times).--timeout <sec>             Set the socket timeout (default 15 seconds).--exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.--trusted-host <hostname>   Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS.--cert <path>               Path to PEM-encoded CA certificate bundle. If provided, overrides the default. See 'SSL Certificate Verification' in pip documentation for more information.--client-cert <path>        Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.--cache-dir <dir>           Store the cache data in <dir>.--no-cache-dir              Disable the cache.--disable-pip-version-checkDon't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.--no-color                  Suppress colored output.--no-python-version-warningSilence deprecation warnings for upcoming unsupported Pythons.--use-feature <feature>     Enable new functionality, that may be backward incompatible.--use-deprecated <feature>  Enable deprecated functionality, that will be removed in the future.

再次确认安装情况

$ which pip
/Library/Frameworks/Python.framework/Versions/2.7/bin/pip$ which pip2
/Library/Frameworks/Python.framework/Versions/2.7/bin/pip2$ which pip2.7
/Library/Frameworks/Python.framework/Versions/2.7/bin/pip2.7$ which pip3
/Library/Frameworks/Python.framework/Versions/3.10/bin/pip3$ which pip3.10
/Library/Frameworks/Python.framework/Versions/3.10/bin/pip3.10
$ pip -V
pip 19.2.3 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip (python 2.7)$ pip2 -V
pip 19.2.3 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip (python 2.7)$ pip2.7 -V
pip 19.2.3 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip (python 2.7)$ pip3 -V
pip 22.2.1 from /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip (python 3.10)$ pip3.10 -V
pip 22.2.1 from /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip (python 3.10)

Mac 安装 pip 看这里就够了,pip、pip2、pip3 再也不懵了相关推荐

  1. vue 安装(看图就够了,皮卡皮卡)

    npm -vnpm install -g cnpm --registry=https://registry.npm.taobao.orgcnpm install -g @vue/clicnpm ins ...

  2. 【奶奶看了也不会】AI绘画 Mac安装stable-diffusion-webui绘制AI妹子保姆级教程

    1.作品图 2.准备工作 目前网上能搜到的stable-diffusion-webui的安装教程都是Window和Mac M1芯片的,而对于因特尔芯片的文章少之又少,这就导致我们还在用老Intel 芯 ...

  3. Mac安装pip 用pip安装python包

    mac安装pip mac上面直接用pip会提示command not found,所以需要安装pip curl https://bootstrap.pypa.io/get-pip.py -o get- ...

  4. mac安装pip命令

    mac安装pip命令 打开终端输入: curl https://bootstrap.pypa.io/get-pip.py | python3 最后一行显示安装成功 用pip3 不是pip 查看版本信息 ...

  5. Mac安装python3并配置pip

    Mac编程操作 Mac安装python3并配置pip 一.安装python3 1.下载安装包 打开python官网 https://www.python.org/downloads/mac-osx/ ...

  6. 解决 mac安装或者更新第三方包安装不上的问题 mac OSX pip OSError: [Errno 1] Operation not permitted

    (1) 写在前面 在安装机器学习python包时,提示Macbook里面的Python库有点旧,就用pip更新一下. $ sudo pip install pandas $ pip install - ...

  7. python 人脸识别调整人脸大的距离_Python 人脸识别就多简单,看这个就够了!

    原标题:Python 人脸识别就多简单,看这个就够了! 今天给大家介绍一个世界上最简洁的人脸识别库 face_recognition,你可以使用 Python 和命令行工具进行提取.识别.操作人脸. ...

  8. 简单3步成功给Mac安装指定Python版本和指定库版本并且随意切换版本,非常简单,不行拿砖砸我

    Mac安装Python真的头疼,我前后斗了一年. Mac默认安装2.7,我们平时2018年都用Python3了. 我按照网友的方法brew install python3,导致Python2和Pyth ...

  9. Mac安装eDEX-UI以及后续Python环境配置

    Mac安装eDEX-UI以及后续Python环境配置 效果 配置 不想看我瞎扯可以直接跳到这 环境配置思路同样适用于Linux发行版. 效果 虽说macOS的界面已经十分美观了,但是对于习惯用TUI跑 ...

最新文章

  1. python给列表中的字典按照字典中的某个键值进行排序
  2. 安装debian第一天遇到的几个问题及解决方案
  3. SpringMVC中@RequestHeader
  4. mysql innodb 锁_MySQL/InnoDB锁机制
  5. Java操作SQL Server数据库
  6. 152. 乘积最大子数组
  7. 【SPOJ 694】Distinct Substrings (更直接的求法)
  8. 借贷记账法下的账户对应关系_会计实操借贷记账法记账规则——会计干货来了快记啊!...
  9. sqlplus中调用shell_C语言程序设计——自己编写一个简易shell程序
  10. linux版gaussian运行,【求助】gaussian 在linux不能运行?急急急 - 量子化学 - 小木虫 - 学术 科研 互动社区...
  11. 如何实现USB自动挂载?
  12. 如何让Typecho支持有趣的 Emoji
  13. SSM框架整合+简单的增删改查的实现
  14. SpringData JPA(一)——什么是SpringData JPA
  15. 统一用户认证和单点登录解决方案
  16. flex:1 代表了什么意思
  17. 易语言 文件捆绑机的原理【转载】
  18. 【回炉重造系列】之Spring AOP简介
  19. 【Docker】Failed to get D-Bus connection: Operation not permitted解决
  20. Android/安卓 半透明设置方法

热门文章

  1. typescript项目中引入汉字转拼音js
  2. $.messager的使用笔记
  3. JavaScript和jQuery实战手册(原书第2版)
  4. FTP服务器安装和搭建
  5. slim android7 nexus7,Nexus 7第二代的CPU是什么
  6. 看过来看过来|自媒体创作者今日运势:宜学习短视频配音技巧
  7. chrome 保存网页_如何在Chrome中保存网页
  8. CTF密码学-加解密总结
  9. 基于C#+SqlServer开发(WinForm)学生宿舍管理系统【100010056】
  10. 整数规划的思路和概念