You are on page 1of 1

#!

/usr/bin/env python3

# -*- coding: utf-8 -*-

"""

Created on Sun Jul 2 13:05:02 2017

@author: Amitesh

"""

import pip

from subprocess import call

type = {'2.x': {'n': 'pip install --upgrade', 'y': 'sudo pip install --upgrade'},

'3.x': {'n': 'pip3 install --upgrade', 'y': 'sudo pip3 install --upgrade'}}

if __name__ == '__main__':

for dist in pip.get_installed_distributions():

# input requirements into variables (that follow)

python_type = '3.x' # '2.x' for python 2.x, '3.x' for python 3.x

sudo = 'n' # 'y' if you want to upgrade as a superuser, 'n' for normal upgrade

call('{type} {package}'.format(type = type[python_type][sudo],package =


dist.project_name), shell=True)

You might also like