Ошибка в записных книжках Azure: "нет отображаемого имени и нет переменной среды $DISPLAY"

Я пытаюсь построить чанки, определенные из NLTK, но получаю ошибку "нет отображаемого имени и нет переменной окружения $DISPLAY". Я использую записные книжки Azure (на основе записных книжек Jupyter).

#In
tags = nltk.pos_tag(tokens)
tags

#Out
#[('stress', 'NN'),
# ('cracks', 'NNS'),
# ('around', 'IN'),
# ('front', 'JJ'),
# ('plastic', 'NN'),
# ('hinge', 'NN')]

#In
entities = nltk.chunk.ne_chunk(tags)
entities

#Out (ERROR)
---------------------------------------------------------------------------
TclError                                  Traceback (most recent call last)
~/anaconda3_501/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
    343             method = get_real_method(obj, self.print_method)
    344             if method is not None:
--> 345                 return method()
    346             return None
    347         else:

~/anaconda3_501/lib/python3.6/site-packages/nltk/tree.py in _repr_png_(self)
    717         from nltk.draw.util import CanvasFrame
    718         from nltk.internals import find_binary
--> 719         _canvas_frame = CanvasFrame()
    720         widget = tree_to_treesegment(_canvas_frame.canvas(), self)
    721         _canvas_frame.add_widget(widget)

~/anaconda3_501/lib/python3.6/site-packages/nltk/draw/util.py in __init__(self, parent, **kw)
   1651         # If no parent was given, set up a top-level window.
   1652         if parent is None:
-> 1653             self._parent = Tk()
   1654             self._parent.title('NLTK')
   1655             self._parent.bind('<Control-p>', lambda e: self.print_to_file())

~/anaconda3_501/lib/python3.6/tkinter/__init__.py in __init__(self, screenName, baseName, className, useTk, sync, use)
   2015                 baseName = baseName + ext
   2016         interactive = 0
-> 2017         self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
   2018         if useTk:
   2019             self._loadtk()

TclError: no display name and no $DISPLAY environment variable

0 ответов

Другие вопросы по тегам