2

I tried to import nltk library in my python code(Mac OS). and i get this error message. is there a specific nltk software i should install? or what the right command to write in the terminal?

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import nltk
  File "/Library/Python/2.7/site-packages/nltk/__init__.py", line 128, in <module>
    from nltk.chunk import *
  File "/Library/Python/2.7/site-packages/nltk/chunk/__init__.py", line 157, in <module>
    from nltk.chunk.api import ChunkParserI
  File "/Library/Python/2.7/site-packages/nltk/chunk/api.py", line 15, in <module>
    from nltk.chunk.util import ChunkScore
  File "/Library/Python/2.7/site-packages/nltk/chunk/util.py", line 13, in <module>
    from nltk.tag.mapping import map_tag
  File "/Library/Python/2.7/site-packages/nltk/tag/__init__.py", line 63, in <module>
    from nltk.tag.sequential    import (SequentialBackoffTagger, ContextTagger,
  File "/Library/Python/2.7/site-packages/nltk/tag/sequential.py", line 25, in <module>
    from nltk.classify import NaiveBayesClassifier
  File "/Library/Python/2.7/site-packages/nltk/classify/__init__.py", line 98, in <module>
    from nltk.classify.textcat import TextCat
  File "/Library/Python/2.7/site-packages/nltk/classify/textcat.py", line 47, in <module>
    import regex as re
  File "/Library/Python/2.7/site-packages/regex.py", line 672, in <module>
    _pattern_type = type(_compile("", 0, {}))
  File "/Library/Python/2.7/site-packages/regex.py", line 425, in _compile
    pattern_locale = _getlocale()[1]
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 562, in getlocale
    return _parse_localename(localename)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 475, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
Stefanus
  • 1,619
  • 3
  • 12
  • 23
sara
  • 189
  • 1
  • 1
  • 11
  • 2
    Possible duplicate of [Pelican 3.3 pelican-quickstart error "ValueError: unknown locale: UTF-8"](http://stackoverflow.com/questions/19961239/pelican-3-3-pelican-quickstart-error-valueerror-unknown-locale-utf-8) – Leb Nov 10 '15 at 14:57
  • Looks like that issue indeed. Try the .bash_profile fix and see if the problem is indeed solved. – Freek Wiekmeijer Nov 10 '15 at 14:58
  • i tried this solution but the problem still occur – sara Nov 10 '15 at 15:39

0 Answers0