pip_upgrade.py 472 B

12345678910111213
  1. #!/usr/bin/python3
  2. import subprocess
  3. import platform
  4. del_eof = -4 if platform.system() == 'Linux' else -6 if platform.system() == 'Windows' else ''
  5. m_dict = eval(str(subprocess.check_output(['pip3', 'list', '-o', '--format', 'json']))[3:del_eof])
  6. with open('pip-upgradeable.txt', 'w') as req:
  7. for i in m_dict:
  8. # if i['latest_filetype'] == 'wheel':
  9. print(i['name'], i['version'], i['latest_filetype'])
  10. req.write(i['name'] + ' ')