skip to Main Content

I feel uncomfortable using cmd and I want to use commands for my python scripts, wondering if there is any way to not use cmd for os.system() and instead changes that to my ubuntu terminal. Thanks!

2

Answers


  1. Per the Python docs, os.system(<command>) executes <command> in a subshell, which is system dependent. There is no way to make os.system() run a Windows specific command as a Unix equivalent. You may be interested in Python’s sys module

    If you edit your question with more specific details as to what commands you are trying to run I might be able to provide better help.

    Login or Signup to reply.
  2. os.system() normally runs system commands depending the OS you are running the script.
    However, you can read this article on Stackoverflow or try to follow further steps to setup an effective environment for Python on Ubuntu on Windows.

    1. Install Bash on Windows
    2. Check for updates
    3. Check out the REPL
    4. Install Pip
    5. Install VirtualEnv
    6. Install VirtualEnvWrapper
    7. Create your first virtualenv
    8. Configure bashrc to keep it working
      More detailes here
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search