避免在命令行上打印DEPRECATION消息



当我点击python -m pip freeze命令时,它首先显示以下警告,然后显示包列表。

DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop sup port for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.

有什么办法可以忽略这个警告吗?

我尝试使用warnings.filterwarnings("ignore"),但它不起作用。

try:

warnings.simplefilter("ignore")

最新更新