如何在Mac OS X上的PyCharm中使用Tensorflow调试器?

时间:2017-05-05 15:47:03

标签: python macos tensorflow machine-learning pycharm

我正在尝试在PyCharm中使用Tensonflow调试器。当我这样做时,我收到此错误:_curses.error: setupterm: could not find terminal

以下是完整的追溯:

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问题。

我已经尝试了在另一个答案中看到的内容,即在运行&gt;编辑配置&gt;默认值&gt; Python中将TERMINFO=/etc/terminfo添加到环境变量中并且不起作用。答案与linux有关,我在Mac OS X上。

如何让Tensonflow调试器在Mac OS X上的PyCharm中运行?

2 个答案:

答案 0 :(得分:1)

更新:你是对的,这似乎是PyCharm中的一个未解决的问题: https://youtrack.jetbrains.com/issue/PY-13062

OLD:首先,您需要设置正确的环境变量:

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

这里讨论了一个几乎完全相同的问题:Setupterm could not find terminal, in Python program using curses

答案 1 :(得分:0)

您可以转到“编辑配置”页面,然后选择“在输出控制台中仿真”。