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

article/2025/9/25 23:25:06

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)

http://chatgpt.dhexx.cn/article/UrBtYI57.shtml

相关文章

关于pip2和pip3共存问题的解决办法

前言 现在在linux系统中&#xff0c;如果你直接用apt安装pip是只能安装pip3的&#xff0c;即只能用命令apt install python3-pip 而如果你继续试图用apt install python-pip来安装pip2的话&#xff0c;会提示你找不到这个包 但是吖&#xff0c;有一些工具还就得用python2运行…

ubuntu安装pip3

1.安装命令 sudo apt-get install python3-pip 2.查看pip3的版本以及对应的python版本 pip3 -V pip 21.1.1 from /usr/local/lib/python3.7/dist-packages/pip (python 3.7) 3.更新pip3 sudo pip3 install --upgrade pip 4.查看pip3安装的包以及版本 pip3 list

升级pip 升级pip3的快速方法

1、修改python镜像地址 我们这里使用的是华为的镜像地址&#xff0c;我挨个测试过了&#xff0c;在学校的网络下使用华为的镜像地址速度会稍微快一些。具体为啥&#xff0c;请咨询学校网管。 2、pip升级或pip3升级 注&#xff1a;-U就是 --upgrade&#xff0c;意思是如果已安…

python3没有pip怎么办_python3 没有 pip3解决方法

原博文 2017-08-31 11:14 − 问题现象:在linux环境下,安装完python3.6.2后,发现并没有pip3功能。 解决方法: https://pip.pypa.io/en/stable/installing/ 1)下载get-pip.py 文件 2)python get-pip.py 3)重新安装python3... 相关推荐 2019-12-25 18:04 − pip3的安装…

pip和pip3(安装与使用)详细讲解

在使用python的时候&#xff0c;经常使用到pip这个工具&#xff0c;可以很方便的线上安装依赖库&#xff0c; 当然pip还有很多参数都可以帮我们去查询一些库信息&#xff0c;在安装python的时候&#xff0c;下载带有pip的安装包就可以直接安装pip啦&#xff0c; 当然没有带pip的…

pip3 常见用法总结

文章目录 换源pip 国内的一些镜像修改源方法&#xff1a;conda 换源 用法总览一、安装 & 移除安装指定包的最新版安装制定包的指定版本移除指定包在 PyPI 上模糊查找相关包 二、查看相关查看所有已安装的包查看指定包的相关信息 三、更新相关更新 pip更新包 四、freeze 的使…

论c++中的文件操作(竞赛必看)通俗易懂

Hello&#xff0c;秋名山码神又回来了&#xff0c;都坐好了&#xff0c;码神发车了&#xff0c;基操勿6。 今天我们来看c中的文件操作&#xff0c;这可谓是竞赛中的重中之重&#xff0c;因为如果你在竞赛中不使用文件操作的话&#xff0c;爆零是绝对的了&#xff0c;我当年一块…

C++ 文件输出与输入

文本文件输入 1.必须包含头文件fstream 2.需要声明一个或多个ofstream的对象&#xff0c;并以自己喜欢的方式对其进命名。 3.使用open&#xff08;&#xff09;方法将ofstream的对象和文件关联起来&#xff0c;使用完文件后使用close方法将其关闭。 4.可以直接用ofstream类…

遥感数据常用库使用笔记整理---netCDF4,h5py

netCDF4使用记录 数据读取&#xff0c;属性读取 import netCDF4 as nc>>>read_obj nc.Dataset(inputFile, moder) #数据读取>>> read_obj.variables.keys()# 获取所有数据集的名称[ulat, ulon, uPRE, ugeospatial_lat_lon_extent]>>> read_obj.va…

相机标定(2)opencv2实现

相机标定步骤 OpenCV使用棋盘格板进行标定&#xff0c;如下图所示。为了标定相机&#xff0c;我们需要输入一系列三维点和它们对应的二维图像点。 1、在黑白相间的棋盘格上&#xff0c;二维图像点很容易通过角点检测找到。 2、而对于真实世界中的三维点呢&#xff1f;由于我们…

C++的文档操作心得

先提出一个问题&#xff1a; 假如我们玩贪吃蛇&#xff0c;玩到最后游戏结束时&#xff0c;显示出游戏的最高纪录&#xff0c;那我们想想&#xff1a;当我们关闭游戏进程时&#xff0c;这个游戏最高纪录是如何保存下来的呢&#xff1f; 由此引出文件操作 1.将maxscore数据保…

文件输入输出(文本文件、二进制文件)(ifstream、ofstream)

一.写入文件流程 创建一个ofstream对象来管理输出流。将该对象与特定文件关联起来。以使用cout方式使用该对象&#xff0c;唯一区别是输出进文件&#xff0c;不是屏幕。关闭文件流. ofstream fout; fout.open(filename); //上面两步可以合并为&#xff1a; ofstream fout(fil…

【IC7】FPGA最高工作频率的计算方法;FPGA最大输出频率;查看handbook的PLL最高频率;Fout_ext;Fout两个参数;FPGA输出1ns脉冲

目录 1 时钟周期 T Tco Tlogic Troute Tsu 2&#xff0c; 故 Tlogic 4 * Tlut   3&#xff0c;  Tco Tsu 12 * Tlut 4&#xff0c;搜索handbook&#xff0c;不要搜索datasheet 4-1 时钟树的特性 4-2 PLL特性&#xff1b;Fout_ext;Fout两个参数 5&#xff0…

CNN与RNN的详细介绍

CNN与RNN的介绍 本文主要总结我对李宏毅老师讲的CNN和RNN的理解&#xff0c;通过对比总结各自的优势&#xff0c;同时加深自己对这方面知识的理解。 1、CNN介绍 CNN是一种利用卷积计算的神经网络。它可以通过卷积计算将原像素很大的图片保留主要特征变成很小的像素图片。本文介…

CNN简介

CNN 卷积神经网络是含有卷积层的神经网络&#xff0c;而卷积层则得名于卷积运算。 Filter 在卷积层中&#xff0c;我们会用一个叫做filter的东西扫过一张图片。这些 filter 啊 它们的大小是,3 3 Channel 的 Size。如果今天是彩色图片的话,那就是 RGB 三个 Channel,如果是…

深度学习(六):CNN介绍

深度学习&#xff08;六&#xff09;&#xff1a;CNN介绍 CNN架构 首先input一张image以后&#xff0c;这张image会通过convolution layer&#xff0c;接下里做max pooling这件事&#xff0c;然后在做convolution&#xff0c;再做max pooling这件事。这个process可以反复无数次…

cnn算法

机器学习算法完整版见fenghaootong-github 卷积神经网络原理(CNN) 卷积神经网络CNN的结构一般包含这几个层&#xff1a; 输入层&#xff1a;用于数据的输入卷积层&#xff1a;使用卷积核进行特征提取和特征映射激励层&#xff1a;由于卷积也是一种线性运算&#xff0c;因此需…

cnn-lstm介绍(2)

1. CNN-LSTM模型。CNN具有注意最明显的特征&#xff0c;因此在特征工程中得到了广泛的应用。LSTM有&#xff0c;按时间顺序扩张的特性&#xff0c;广泛应用于时间序列中。 根据CNN和LSTM股票预测模型的特点 建立了基于CNN的LSTM模型-e模型结构 示意图如图1所示&#xff0c;主…

实例分割模型Mask R-CNN详解:从R-CNN,Fast R-CNN,Faster R-CNN再到Mask R-CNN

Mask R-CNN是ICCV 2017的best paper&#xff0c;彰显了机器学习计算机视觉领域在2017年的最新成果。在机器学习2017年的最新发展中&#xff0c;单任务的网络结构已经逐渐不再引人瞩目&#xff0c;取而代之的是集成&#xff0c;复杂&#xff0c;一石多鸟的多任务网络模型。Mask …

CNN与RNN的区别

从应用方面上来看&#xff0c;我了解到的CNN用到做图像识别比较多&#xff0c;而RNN在做到语言处理多一点&#xff0c;如果拿来比喻的话&#xff0c;CNN如同眼睛一样&#xff0c;正是目前机器用来识别对象的图像处理器。相应地&#xff0c;RNN则是用于解析语言模式的数学引擎&a…