1. 背景
打算用pytorch來進行文本分類,想運行 first-text-classification-in-pytorch裏的代碼,需要安裝spacy及對應的語言包(只需要英文),下面記錄如何安裝。
2. 安裝步驟
步驟1
運行:
conda install -c conda-forge spacy
或者:
pip install -U spacy
步驟2
- 訪問並下載en_core_web_sm-2.2.0.tar.gz
- 運行:
pip install en_core_web_sm-2.2.0.tar.gz
如果運行失敗,則運行:
tar -zxvf en_core_web_sm-2.2.0.tar.gz
cd en_core_web_sm-2.2.0
python setup.py build
python setup.py install
步驟3
運行:
python -m spacy link en_core_web_sm en
3. 參考
參考: