1. 程式人生 > >去掉python的警告

去掉python的警告

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')