- 检查当前pip版本
在cmd下输入
pip --version
可显示当前pip库版本
- 安装第三方库
pip install 库名称(如requests)
安装第三方库
pip install reportlab==4.0.7
安装指定版本的reportlab
- 显示第三方库基本信息
pip show reports
Name: reportlab
Version: 4.0.7
Summary: The Reportlab Toolkit
Home-page: https://www.reportlab.com/
Author: Andy Robinson, Robin Becker, the ReportLab team and the community
Author-email: reportlab-users@lists2.reportlab.com
License: BSD license (see license.txt for details), Copyright (c) 2000-2022, ReportLab Inc.
Location: e:\program files\python\lib\site-packages
Requires: pillow
Required-by:
- 列出所有过时的库
pip list -o
pip list --outdated
pip list -o
Package Version Latest Type
---------- ------- ------ -----
pypdf 3.8.1 3.17.1 wheel
setuptools 65.5.0 69.0.2 wheel
pip list --outdated
Package Version Latest Type
---------- ------- ------ -----
pypdf 3.8.1 3.17.1 wheel
setuptools 65.5.0 69.0.2 wheel
- 将库升级到最新版本
pip install -U pip requests
更新requests库,若未安装request库,该命令会安装request库
- 更改安装库的源
国内从Pypi安装库会很慢,可以更改安装库的源,提高下载速度(以更改为清华大学的源为例)
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple
配置全局索引URL
要永久使用镜像站点安装库,不必每次安装时都键入url,可使用config选项全局设置url。以更改为清华大学站点为例:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
(1) 清华大学(完全度和速度都很好,是一个优秀的pip镜像源)
https://pypi.tuna.tsinghua.edu.cn/simple
(2)阿里云(完全度和速度也很好,是一个不错的选择)
https://mirrors.aliyun.com/pypi/simple/
(3)网易(速度比较快,但是完全度有限)
https://mirrors.163.com/pypi/simple/
(4)豆瓣(速度较快,但是完全度也有限)
https://pypi.douban.com/simple/
(5)百度云(速度较快,但是完全度也有限)
https://mirror.baidu.com/pypi/simple/
(6)中科大(速度较快,但完全度不如前面几个镜像源)
https://pypi.mirrors.ustc.edu.cn/simple/
(7)华为云(完全度和速度均中等)
https://mirrors.huaweicloud.com/repository/pypi/simple/
(8)腾讯云(速度一般,完全度也一般)
https://mirrors.cloud.tencent.com/pypi/simple/