check if package is installed pip code example
Example 1: how to check if pip is installed
File"stdin",line 1
pip list
Syntax Error: invalid syntax
Example 2: 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