import pkg_resources
from pkg_resources import DistributionNotFound, VersionConflict
dependencies = ['Werkzeug>=0.6.1', 'Flask>=0.9']
pkg_resources.require(dependencies)
How to check if my Python has all required packages?