Skip to content

Instantly share code, notes, and snippets.

@Ation
Created April 22, 2015 20:51
Show Gist options
  • Save Ation/32617a1efc7ecc65b9f3 to your computer and use it in GitHub Desktop.
Save Ation/32617a1efc7ecc65b9f3 to your computer and use it in GitHub Desktop.
Check if python module installed
import subprocess
def is_python_module_installed(module):
command = ['pip', 'list']
p = PO( command, stdin=PIPE, stdout = PIPE, stderr = PIPE)
output,err = p.communicate
for module in output.decode('utf-8').splitlines():
if module.split(' ')[0] == module:
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment