9

I use Pycharm and when I run this Python code

os.system("clear")

I get this error:

TERM environment variable not set

In the Python Console, in the variables, I put

export TERM = xterm

What else can I do?

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
darek_82
  • 361
  • 1
  • 3
  • 13

2 Answers2

18

Try this configuration, i found it very helpful after struggling finding the solution and after configure the correct TERM variable.

enter image description here

naor ohayon
  • 319
  • 2
  • 8
6

There is a simple solution for this. You need to go to the 'Run/Debug configuration' You can do this by going to 'Run' and selecting Edit configuration option on the title bar.

Then you can go to the environment variable option to add the environment variable 'TERM' and set the value as 'xterm-color'

you can check it out on this website. http://softwaretester.info/pycharm-term-environment-variable-not-set/

  • That doesn't really help. See https://stackoverflow.com/q/56306486/2648551 for an explanation. You can emulate the terminal as suggested in [the other answer](https://stackoverflow.com/a/65161315/2648551) here. – colidyre Feb 26 '21 at 12:54