Runnig py -m pip list in windows powershell, produces:
py -m pip list
Package Version --------------- ------- -umpy 1.15.4 autogui 0.1.8
import subprocess print((bytes(subprocess.check_output(['pip', 'uninstall', '-umpy'], stderr=subprocess.STDOUT)).decode()))
To automate it in a python script.