NLTK 설치 실패 해결 LookupError:Resource punkt_tab not found. 에러
LookupError:
**********************************************************************
Resource punkt_tab not found.
Please use the NLTK Downloader to obtain the resource:
>>> import nltk
>>> nltk.download('punkt_tab')
For more information see: https://www.nltk.org/data.html
Attempted to load tokenizers/punkt_tab/english/
Searched in:
- 'C:\\Users\\사용자이름/nltk_data'
- 'C:\\Users\\ 사용자이름 \\anaconda3\\envs\\yjenv\\nltk_data'
- 'C:\\Users\\ 사용자이름 \\anaconda3\\envs\\yjenv\\share\\nltk_data'
- 'C:\\Users\\ 사용자이름 \\anaconda3\\envs\\yjenv\\lib\\nltk_data'
- 'C:\\Users\\ 사용자이름 \\AppData\\Roaming\\nltk_data'
- 'C:\\nltk_data'
- 'D:\\nltk_data'
- 'E:\\nltk_data'
**********************************************************************
nltk 설치 방법
1. 콘다에서 pip install nltk
pip install nltk
설치 후 LookupError가 발생하는 경우가 종종 있다.
그럴 때 2번 코드를 실행하면 된다는 솔루션이 많다.
2-1. jupyter lab or jupyter notebook에서 아래 코드 실행
import nltk
# punkt 다운로드
nltk.download('punkt')
그런데 2번 코드도 안되는 경우가 있다.
그럴 때는 아래 3번 코드를 실행시키면 된다.
2-2. jupyter lab or jupyter notebook에서 아래 코드 실행
import nltk
import ssl
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
pass
else:
ssl._create_default_https_context = _create_unverified_https_context
nltk.download()
그러면 깃털 모양과 함께 NLTK downloader창이 뜬다
여기서 왼쪽의 "Download"버튼을 클릭하면 설치가 완료된다.
설치가 끝나면 X버튼을 눌러 닫아주면 설치가 완료된다
설치 완료!