NLTK下载错误的终极解决办法

时间:2024-04-10 22:09:41

Downloading package brown to
    C:\Users\Ken\AppData\Roaming\nltk_data...
Error downloading 'brown' from
    <https://raw.githubusercontent.com/nltk/nltk_data/gh-
    pages/packages/corpora/brown.zip>:   <urlopen error
    [WinError 10061] 由于目标计算机积极拒绝,无法连接。>

Downloading package averaged_perceptron_tagger to
    C:\Users\Ken\AppData\Roaming\nltk_data...
Error downloading 'averaged_perceptron_tagger' from
    <https://raw.githubusercontent.com/alvations/nltk_data
    /gh-pages/packages/taggers/averaged_perceptron_tagger.
    zip>:   HTTP Error 404: Not Found

LookupError: Recource 'tokenizers/punkt/english.pickle' not found

python -m nltk.downloader -u http://nltk.github.com averaged_perceptron_tagger

以上种种错误的解决办法: 离线下载NLTK Data

先去Github下载  https://github.com/nltk/nltk_data/tree/gh-pages 得到nltk_data-gh-pages.zip文件

NLTK下载错误的终极解决办法通过比较可以发现压缩包中的文件结构和%appdata%/nltk_data下的目录结构是一致的,

所以把packages里面的东西复制到%appdata%/nltk_data里面就可以了