Check version of installed python packages

Below bash command will let you find the version of packages for your python interpreter. Make sure you are running the correct version of python enterpreter.

Update: 2020-05-14

for i in pandas numpy sqlalchemy logging logging.handlers datetime sys re os enum; do 
/anaconda3/bin/python -c "import $i; print('{0:.<20} :{1}'.format($i.__name__, $i.__version__ if hasattr($i, '__version__') else 'module exists with no version attribute'))"; 
done

 

Old stuff below

$ for i in <list of packages>; do <complete path to>/python -c “import $i; print($i.__version__)”; done

 

Example:

for i in pandas numpy scipy; do /anaconda3/bin/python -c "import $i; print($i.__version__)"; done

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *