pip
1. 基本介绍
pip 官网:https://pypi.org/project/pip
pip 是 python 开发提供的第三方库包管理器
类似的包管理工具
- npm
- pnpm
- yarn
- gem(Ruby)
- pub(C#)
2. 安装
在安装 python 的时候会自动安装
查看版本
bash
pip -V3. 相关指令
(1)版本确认
bash
pip -V(2)列出本地安装包
bash
pip list(3)安装包
bash
pip install 包名(4)镜像源安装
清华镜像源:https://mirrors.tuna.tsinghua.edu.cn/
bash
pip install 包名 -i 镜像源地址(5)更新包
bash
pip install -U 包名(6)卸载包
bash
pip uninstall 包名(7)相关包检索
bash
pip search 关键字(8)查看包详细信息
bash
pip show 包名(9)输出本地包详细信息
bash
pip freeze(10)更新 pip
bash
pip install --upgrade pip4. 常用镜像源
bash
pip install 包名 -i 镜像源地址- 清华大学 PyPI 镜像: https://pypi.tuna.tsinghua.edu.cn/simple
- 阿里云 PyPI 镜像: https://mirrors.aliyun.com/pypi/simple/
- 中科大 PyPI 镜像: https://pypi.mirrors.ustc.edu.cn/simple/
- 豆瓣 PyPI 镜像: https://pypi.douban.com/simple/
- 北京外国语大学 PyPI 镜像: https://pypi.mirrors.bfsu.edu.cn/simple/
- 华为云 PyPI 镜像: https://repo.huaweicloud.com/repository/pypi/simple/
5. 配置镜像源
清华镜像源
bash
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn阿里镜像源
bash
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com