我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用pip.utils.import_or_raise()。
def check_required_packages(self): import_or_raise( 'wheel.bdist_wheel', CommandError, "'pip wheel' requires the 'wheel' package. To fix this, run: " "pip install wheel" ) pkg_resources = import_or_raise( 'pkg_resources', CommandError, "'pip wheel' requires setuptools >= 0.8 for dist-info support." " To fix this, run: pip install --upgrade setuptools" ) if not hasattr(pkg_resources, 'DistInfoDistribution'): raise CommandError( "'pip wheel' requires setuptools >= 0.8 for dist-info " "support. To fix this, run: pip install --upgrade " "setuptools" )