python环境|pip安装|pip镜像使用

管理和安装 Python 软件包(第三方库)的官方工具

pip 本身是一个专注于包管理的工具,而它的最佳搭档是venv

检测是否安装pip

Image text

windows安装 pip

一般安装包里都有pip,直接安装即可
通过cmd 命令,查询当前版本
python --version
pip --version
如果没有通过配置系统属性

Image text

Image text

pip升级最新版本

pip install --upgrade pip

Image text

查询安装列表

pip list

指定关键字检索

# 搜索特定包
pip list | findstr requests      # Windows
pip list | grep requests        # Mac/Linux

镜像的配置

临时配置

pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn

Image text

永久配置

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn

Image text

查询当前配置

  • pip config list -v

Image text

更多推荐