问题描述:

使用

os.system('cls')

命令清空屏幕上的输出时,报错,显示错误为:

sh: cls: command not found

  

问题解决:

首先,停止使用jupyter notebook。因为jupyter使用网页,不断拦截标准输出流到界面上,会忽略清屏的操作。

 

将代码复制到pycharm运行,

os.system('cls')

  改为

os.system('clear')

  

在Preference --> Build,Execution,Deployment--> Console -->  Python Console中添加一个环境变量:

python错误:sh: cls: command not found

 

在配置里勾选 emulate terminal in output console

python错误:sh: cls: command not found

 

再次运行代码,问题解决~

相关文章:

  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-02-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-17
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
  • 2022-12-23
相关资源
相似解决方案