Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash check if python package is installed

$ python2 -m doesnt_exist |& grep -q 'No module named' && echo 'Nope' || echo 'Yup'
Nope

$ python2 -m math |& grep -q 'No module named' && echo 'Nope' || echo 'Yup'
Yup
Source by askubuntu.com #
 
PREVIOUS NEXT
Tagged: #bash #check #python #package #installed
ADD COMMENT
Topic
Name
4+4 =