去掉python的警告

时间:2024-07-30 09:06:14
1.常规警告
import warnings
warnings.filterwarnings("ignore")

2.安装gensim,在python中导入的时候出现一个警告:

warnings.warn("detected Windows; aliasing chunkize to chunkize_serial")
UserWarning: detected Windows; aliasing chunkize to chunkize_serial

解决方法:输入下面两条语句即可:

import warnings
warnings.filterwarnings(action='ignore',category=UserWarning,module='gensim')