Skip to content

Instantly share code, notes, and snippets.

@nariaki3551
Last active December 10, 2016 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nariaki3551/ec51cdc00e145e296953071458c27543 to your computer and use it in GitHub Desktop.
Save nariaki3551/ec51cdc00e145e296953071458c27543 to your computer and use it in GitHub Desktop.
# pip3(pip) install sh で shをインストールしておく必要がある
from sh import pip3
package_list = [row.split()[0] for row in list(pip3('list', '-o', '--format=columns'))[2:]]
if len(package_list) == 0:
print('All package are already up-to-date!')
else:
if 'pip' in package_list:
package_list.remove('pip')
package_list.insert(0,'pip')
for package in package_list:
print('install --upgrade '+package)
print(pip3('install', '--upgrade', package))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment