Setupterm could not find terminal, in Python program using curses

前端 未结 6 1668
礼貌的吻别
礼貌的吻别 2020-11-28 13:07

I am trying to get a simple curses script to run using Python (with PyCharm 2.0).

This is my script:

import curses
stdscr = curses.initscr()
curses.n         


        
6条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 13:49

    If you are using macOS and running PyCharm you will have to set environment variables from the IDE itself, for execution scope.

    Edit Configurations -> Environment variables

    then add the below name-value pairs

    TERM linux

    TERMINFO /etc/zsh

    The above is equivalent to exporting environment variable from the console which is done like this

    $ export TERM=linux
    $ export TERMINFO=/bin/zsh
    

    the default for TERM is xterm, other values are [konsole, rxvt] rxvt for example is often built with support for 16 colors. You can try to set TERM to rxvt-16color.

    /bin/zsh is path of the terminal application that I use in mac.

    It's like telling your program that you will be logging into linux(TERM) like terminal which can be found at /bin/zsh. For using bash shell it could be something like /bin/bash .

提交回复
热议问题