本文整理汇总了Python中pip._internal.exceptions.UninstallationError方法的典型用法代码示例。如果您正苦于以下问题:Python exceptions.UninstallationError方法的具体用法?Python exceptions.UninstallationError怎么用?Python exceptions.UninstallationError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pip._internal.exceptions
的用法示例。
在下文中一共展示了exceptions.UninstallationError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pip._internal import exceptions [as 别名]
# 或者: from pip._internal.exceptions import UninstallationError [as 别名]
def __init__(self, pth_file):
if not os.path.isfile(pth_file):
raise UninstallationError(
"Cannot remove entries from nonexistent file %s" % pth_file
)
self.file = pth_file
self.entries = set()
self._saved_lines = None
示例2: __init__
# 需要导入模块: from pip._internal import exceptions [as 别名]
# 或者: from pip._internal.exceptions import UninstallationError [as 别名]
def __init__(self, pth_file):
# type: (str) -> None
if not os.path.isfile(pth_file):
raise UninstallationError(
"Cannot remove entries from nonexistent file %s" % pth_file
)
self.file = pth_file
self.entries = set() # type: Set[str]
self._saved_lines = None # type: Optional[List[bytes]]
示例3: _uninstall
# 需要导入模块: from pip._internal import exceptions [as 别名]
# 或者: from pip._internal.exceptions import UninstallationError [as 别名]
def _uninstall(req, cmd, dont_prompt):
from pip._internal.exceptions import UninstallationError
args = [req]
if dont_prompt:
args.append("--yes")
options, cmd_args = cmd.parse_args(args)
try:
cmd.run(options, cmd_args)
except UninstallationError as e:
if "not installed" not in str(e):
raise
log.warning("%s is not installed, skipping", req)