I am trying to write a script to open the windows console, then install a python package with pip and finally close.
This was my initial try
import os os.system('pip install package') The installations fails. It seems I need to open first the console and then pip, to make it work so 2nd try
import os os.system('cmd.exe') os.system('pip install package') If I do it in this way it is waiting until the console is closed to execute pip
3rd try
import os os.system('cmd.exe') os.system('exit') os.system('pip install package') Exit is not recognised
I tried also with os.system('taskkill cmd.exe') or
import sys sys.exit() or
raise SystemExit No success so far
os.system('C:\Python\Python35-32\Scripts\pip install package')- give path to pip on your system