Created
April 22, 2015 20:51
-
-
Save Ation/32617a1efc7ecc65b9f3 to your computer and use it in GitHub Desktop.
Check if python module installed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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