I am using pycharm community version for python 3.6.1 as I'm beginner when i try to run simple tokenize program -
import nltk
from nltk.tokenize import word_tokenize
word_tokenize(" hellow world im nltk")
I get the following error -
C:UsersAmnaaAppDataLocalProgramsPythonPython36-32python.exe E:/test/token.py
Traceback (most recent call last):
File "E:/test/token.py", line 1, in <module>
import nltk
File "C:UsersAmnaaAppDataLocalProgramsPythonPython36-32libsite-packages
ltk\__init__.py", line 89, in <module>
from nltk.internals import config_java
File "C:UsersAmnaaAppDataLocalProgramsPythonPython36-32libsite-packages
ltkinternals.py", line 11, in <module>
import subprocess
File "C:UsersAmnaaAppDataLocalProgramsPythonPython36-32libsubprocess.py", line 126, in <module>
import threading
File "C:UsersAmnaaAppDataLocalProgramsPythonPython36-32lib hreading.py", line 7, in <module>
from traceback import format_exc as _format_exc
File "C:UsersAmnaaAppDataLocalProgramsPythonPython36-32lib raceback.py", line 5, in <module>
import linecache
File "C:UsersAmnaaAppDataLocalProgramsPythonPython36-32liblinecache.py", line 11, in <module>
import tokenize
File "C:UsersAmnaaAppDataLocalProgramsPythonPython36-32lib okenize.py", line 35, in <module>
from token import *
File "E: est oken.py", line 2, in <module>
from nltk.tokenize import word_tokenize
File "C:UsersAmnaaAppDataLocalProgramsPythonPython36-32libsite-packages
ltk okenize\__init__.py", line 64, in <module>
from nltk.tokenize.mwe import MWETokenizer
File "C:UsersAmnaaAppDataLocalProgramsPythonPython36-32libsite-packages
ltk okenizemwe.py", line 31, in <module>
from nltk.util import Trie
File "C:UsersAmnaaAppDataLocalProgramsPythonPython36-32libsite-packages
ltkutil.py", line 13, in <module>
import pydoc
File "C:UsersAmnaaAppDataLocalProgramsPythonPython36-32libpydoc.py", line 72, in <module>
from traceback import format_exception_only
ImportError: cannot import name 'format_exception_only'
Process finished with exit code 1
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…