如何在 macOS 上安装 PIP ?

PIP 是任何 Python 开发人员必备的工具,因为它简化了安装和管理 Python 包的过程。本教程是为 macOS 用户量身定制的,并假设对使用终端有基本的了解。

必备条件

在安装 PIP 之前,必须确保您的系统上已经安装了 Python。Python 3.4 及更高版本默认包含 PIP。您可以通过终端输入 python --version 或者 python3 --version 来快速检查 Python 版本。如果没有安装 Python,请按照下面的步骤将其与 PIP 一起安装。

Step 1: Installing Python

如果你的 macOS 上还没有安装 Python,你可以从 Python 官方网站或使用 macOS 的软件包管理器 Homebrew 轻松地安装它。为了使用 Homebrew 进行无缝安装,首先打开终端,然后执行以下命令安装 Homebrew 包管理器。

复制代码
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

安装 Homebrew 后,输入 brew install python 安装 Python,此方法在安装 Python 的同时安装 PIP。

Step 2: Verifying PIP Installation

安装 Python 后,应该默认安装 PIP。要验证这一点,请输入以下命令:

复制代码
pip --version

或者

复制代码
pip3 --version

Step 3: Updating PIP

要更新 PIP,只需运行以下命令

复制代码
pip install --upgrade pip

或者

复制代码
pip3 install --upgrade pip

Step 4: Using PIP

安装软件包

复制代码
pip install package_name

卸载软件包

复制代码
pip uninstall package_name

搜索软件包

复制代码
pip search package_name

我的开源项目

相关推荐
猫头虎13 分钟前
2025最新OpenEuler系统安装MySQL的详细教程
linux·服务器·数据库·sql·mysql·macos·openeuler
hui函数11 小时前
如何解决 pip install 编译报错 ‘cl.exe’ not found(缺少 VS C++ 工具集)问题
开发语言·c++·pip
hui函数13 小时前
Python系列Bug修复|如何解决 pip install 安装报错 invalid command ‘bdist_wheel’(缺少 wheel)问题
python·bug·pip
hui函数13 小时前
Python系列Bug修复|如何解决 pip install -r requirements.txt 私有索引未设为 trusted-host 导致拒绝 问题
python·bug·pip
hui函数14 小时前
Python系列Bug修复|如何解决 pip install 安装报错 Backend ‘setuptools.build_meta’ 不可用 问题
python·bug·pip
雪域迷影14 小时前
MacOS中安装并配置Redis
redis·macos·策略模式
猫头虎15 小时前
Claude Code 2026 年1月9日迎来大更新:Agent 能力增强(2.1.0 详解 + 升级指南)
ide·人工智能·macos·langchain·编辑器·aigc·ai编程
小锋学长生活大爆炸15 小时前
【踩坑】MacOS26开启软件的麦克风权限,如腾讯会议
macos·会议·腾讯会议·安全模式·权限·踩坑·麦克风
hui函数16 小时前
Python系列Bug修复|如何解决 pip install -r requirements.txt 私有仓库认证失败 401 Unauthorized 问题
python·bug·pip
hui函数16 小时前
Python系列Bug修复|如何解决 pip install -r requirements.txt 子目录可编辑安装缺少 pyproject.toml 问题
python·bug·pip