갈루아의 반서재


ImportError: cannot import name PunktWordTokenizer 에서는 해결 방법으로 NLTK 버전업그레이드를 제시하고 있다.


현재 NLTK 버전은 3.2.4 이다.

1
2
3
4
5
6
7
(envalicia) root@localhost:~# python
Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 201617:53:06)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help""copyright""credits" or "license" for more information.
>>> import nltk
>>> nltk.__version__
'3.2.4'
cs


아래와 같이 버전 업그레이드를 했지만 여전히 import error 를 발생시킨다.

1
2
3
4
5
6
7
8
9
10
11
12
(envalicia) root@localhost:~# pip install -U nltk
(envalicia) root@localhost:~# python
Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 201617:53:06)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help""copyright""credits" or "license" for more information.
>>> import nltk
>>> nltk.__version__
'3.2.5'
>>> from nltk.tokenize import PunktWordTokenizer
Traceback (most recent call last):
  File "<stdin>", line 1in <module>
ImportError: cannot import name 'PunktWordTokenizer'
cs


혹시 해결책 아시는 분 댓글 부탁드립니다.