2017-05-05 95 views
2

我想在PyCharm中使用Tensonflow調試器。當我做我得到這個錯誤:_curses.error: setupterm: could not find terminal如何在Mac OS X上的PyCharm中使用Tensorflow調試器?

以下是完整的回溯:如果我運行從終端的代碼

Traceback (most recent call last): 
    File "/Users/mddrill/PycharmProjects/NumberReaderNN/number_reader.py", line 163, in <module> 
    [optimizer, loss_func, train_prediction], feed_dict=feed_dict 
    File "/anaconda/lib/python3.6/site-packages/tensorflow/python/debug/wrappers/framework.py", line 411, in run 
    self._run_call_count)) 
    File "/anaconda/lib/python3.6/site-packages/tensorflow/python/debug/wrappers/local_cli_wrapper.py", line 210, in on_run_start 
    self._prep_cli_for_run_start() 
    File "/anaconda/lib/python3.6/site-packages/tensorflow/python/debug/wrappers/local_cli_wrapper.py", line 228, in _prep_cli_for_run_start 
    self._run_cli = ui_factory.get_ui(self._ui_type) 
    File "/anaconda/lib/python3.6/site-packages/tensorflow/python/debug/cli/ui_factory.py", line 56, in get_ui 
    return curses_ui.CursesUI(on_ui_exit=on_ui_exit) 
    File "/anaconda/lib/python3.6/site-packages/tensorflow/python/debug/cli/curses_ui.py", line 263, in __init__ 
    self._screen_init() 
    File "/anaconda/lib/python3.6/site-packages/tensorflow/python/debug/cli/curses_ui.py", line 374, in _screen_init 
    self._stdscr = curses.initscr() 
    File "/anaconda/lib/python3.6/curses/__init__.py", line 30, in initscr 
    fd=_sys.__stdout__.fileno()) 
_curses.error: setupterm: could not find terminal 

調試器的工作原理,所以這絕對是一個PyCharm問題。

我已經嘗試了我在另一個答案中看到的問題,即在運行>編輯配置>默認值> Python中將TERMINFO=/etc/terminfo添加到環境變量中,但這種方式無效。答案與Linux有關,而且我在Mac OS X上。

如何讓Tensonflow調試器在Mac OS X上的PyCharm中工作?

+0

您是否嘗試過附加到進程:http://stackoverflow.com/a/31400673/3657941 –

+0

@DavidCullen它似乎掛在「附加到PID = 的進程」。無論哪種方式,如果我不得不啓動一個終端來進行調試,它將會破壞使用IDE的目的。 –

回答

1

UPDATE:你說得對,看來這是PyCharm一個開放的問題: https://youtrack.jetbrains.com/issue/PY-13062


OLD: Tipically,你需要設置適當的環境變量:

export TERM=xterm-new 
export TERMINFO=/etc/terminfo 

這裏已經討論了幾乎相同的問題:Setupterm could not find terminal, in Python program using curses

+0

這似乎不適用於Mac。這就是我問這個問題的原因。 –

+1

你是對的,請看我的更新 – purpletentacle