Python库升级标准流程~

1.检查正在使用的库是否有新的版本:

python 复制代码
pip list -o

输出结果(例):

python 复制代码
Package            Version     Latest    Type
------------------ ----------- --------- -----
astroid            4.0.2       4.1.2     wheel

2.检查该库被谁依赖:

python 复制代码
pip show astroid

输出结果(例):

python 复制代码
Name: astroid
Version: 4.0.2
Summary: An abstract syntax tree for Python with inference support.
Home-page: 
Author: 
Author-email: 
License-Expression: LGPL-2.1-or-later
Location: D:\zhb\Python\thsautobuy\.venv\Lib\site-packages
Requires: 
Required-by: pylint
  1. 从结果上看astroid被pylint所调用,需再进一步检查其支持的版本范围:
python 复制代码
pipdeptree --packages pylint

输出结果(例):

python 复制代码
pylint==4.0.5
├── astroid [required: >=4.0.2,<=4.1.dev0, installed: 4.0.4]
├── colorama [required: >=0.4.5, installed: 0.4.6]
├── dill [required: >=0.3.6, installed: 0.4.1]
├── dill [required: >=0.3.7, installed: 0.4.1]
├── isort [required: >=5,<9,!=5.13, installed: 8.0.1]
├── mccabe [required: >=0.6,<0.8, installed: 0.7.0]
├── platformdirs [required: >=2.2, installed: 4.9.6]
└── tomlkit [required: >=0.10.1, installed: 0.15.0]
  1. 检查需要更新的库发布了哪些版本:
python 复制代码
pip index versions astroid

输出结果(例):

python 复制代码
astroid (4.1.2)
Available versions: 4.1.2, 4.1.1, 4.1.0, 4.0.4, 4.0.3, 4.0.2, 4.0.1, 4.0.0, 3.3.11, 3.3.10, 3.3.9, 3.3.8, 3.3.6, 3.3.5, 3.3.4, 3.3.3, 3.3.2, 3.3.1, 3.3.0, 3.2.4, 3.2.3, 3.2.2, 3.2.1, 3.2.0, 3.1.0, 3.0.3, 3.0.2, 3.0.1, 3.0.0, 2.15.8, 2.15.7, 2.15.6, 2.15.5, 2.15.4, 2.15.3, 2.15.2, 2.15.1, 2.15.0, 2.14.2, 2.14.1, 2.14.0, 2.13.5, 2.13.4, 2.13.3, 2.13.2, 2.12.14, 2.12.13, 2.12.12, 2.12.11, 2.12.10, 2.12.9, 2.12.8, 2.12.7, 2.12.6, 2.12.5, 2.12.4, 2.12.3, 2.12.2, 2.12.1, 2.12.0, 2.11.7, 2.11.6, 2.11.5, 2.11.4, 2.11.3, 2.11.2, 2.11.1, 2.11.0, 2.10.0, 2.9.3, 2.9.2, 2.9.1, 2.9.0, 2.8.6, 2.8.5, 2.8.4, 2.8.3, 2.8.2, 2.8.1, 2.8.0, 2.7.3, 2.7.2, 2.7.1, 2.7.0, 2.6.6, 2.6.5, 2.6.4, 2.6.3, 2.6.2, 2.6.1, 2.6.0, 2.5.8, 2.5.7, 2.5.6, 2.5.5, 2.5.4, 2.5.3, 2.5.2, 2.5.1, 2.5, 2.4.2, 2.4.1, 2.4.0, 2.3.3, 2.3.2, 2.3.1, 2.3.0, 2.2.5, 2.2.4, 2.2.3, 2.2.2, 2.2.1, 2.2.0, 2.1.0, 2.0.4, 2.0.3, 2.0.2, 2.0.1, 2.0, 1.6.6, 1.6.5, 1.6.4, 1.6.3, 1.6.2, 1.6.1, 1.6.0, 1.5.3, 1.5.2, 1.5.1, 1.5.0, 1.4.9, 1.4.8, 1.4.7, 1.4.6, 1.4.5, 1.4.4, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.3.8, 1.3.7, 1.3.6, 1.3.5, 1.3.4, 1.3.3, 1.3.2, 1.3.1, 1.3.0, 1.2.1, 1.2.0, 1.1.1, 1.1.0, 1.0.1, 1.0.0
  INSTALLED: 4.0.2
  LATEST:    4.1.2
  1. 选择正确的升级版本并升级:

astroid库最新版已经发布到4.1.2但是,pylint只支持4.0.2~4.1.dev0之间的版本,所以我们可以将它升级到最高支持的版本4.0.4, 方法:

python 复制代码
pip install --upgrade astroid==4.0.4

返回(略).

相关推荐
神奇的程序员7 小时前
我的软件冲进苹果商店下载榜前 50 了
前端
阳光是sunny8 小时前
别再被 worktree 绕晕了!AI 编程时代你必须掌握的 Git 隔离神器
前端·人工智能·后端
orion579 小时前
Missing Semester Class1:course overview and introduction of shell
linux
万少9 小时前
万少的博客 - 技术分享与解决方案
前端·javascript·后端
apocelipes11 小时前
常用编程语言和库的正则表达式性能对比
c语言·c++·python·性能优化·golang·开发工具和环境
尘世中一位迷途小书童11 小时前
用 Cesium 撸了一个森林火情监控大屏,弧线、粒子、发光效果都齐了
前端·javascript
IT_陈寒12 小时前
垃圾回收器选错了,我的Java服务内存炸了
前端·人工智能·后端
月光下的丝瓜13 小时前
Flutter 国内安装指南
前端·flutter
用户83562907805113 小时前
使用 Python 在 PDF 中创建与管理书签
后端·python
玄星啊13 小时前
AI 编程的第 30 天,我怀念古法 Coding 了
前端·ai编程