简体   繁体   中英

How can I use the Tensorflow debugger in PyCharm on Mac OS X?

I am trying to use the Tensonflow debugger in PyCharm. When I do I get this error: _curses.error: setupterm: could not find terminal

Here is the full traceback:

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

The debugger works if I run the code from a terminal, so this is definitely a PyCharm issue.

I have tried what I saw in another answer which is to add TERMINFO=/etc/terminfo to the environment variables in Run>Edit Configurations>Defaults>Python and that didn't work. The answer pertained to linux, and I'm on Mac OS X.

How can I get the Tensonflow debugger to work in PyCharm on Mac OS X?

UPDATE : You are right, it seems this is an open issue in PyCharm: https://youtrack.jetbrains.com/issue/PY-13062


OLD: Tipically, you need to set the proper environment variables:

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

An almost identical problem has been discussed here: Setupterm could not find terminal, in Python program using curses

您可以进入“编辑配置”页面,然后选择“在输出控制台中模拟”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM