Cannot import nltk under OSX

2019-09-01 06:28发布

问题:

I use pip install -U nltk to install it. After pip list I can get nltk (3.0.0). Also sys.path includes location of nltk.

But when run import nltk, it shows ImportError: No module named nltk

I use OSX Yosemite, python2.7

I cannot figure out why it happen. Thank you for any suggestion.

回答1:

You might want to try the free Anaconda distribution of Python instead. NLTK comes pre-installed in Anaconda, along with many other popular packages for data analysis, etc. It's a lot easier than having to install & manage hundreds of separate packages individually.

https://store.continuum.io/cshop/anaconda/