本文整理汇总了Python中pip._internal.locations.USER_CACHE_DIR属性的典型用法代码示例。如果您正苦于以下问题:Python locations.USER_CACHE_DIR属性的具体用法?Python locations.USER_CACHE_DIR怎么用?Python locations.USER_CACHE_DIR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类pip._internal.locations
的用法示例。
在下文中一共展示了locations.USER_CACHE_DIR属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_clear
# 需要导入模块: from pip._internal import locations [as 别名]
# 或者: from pip._internal.locations import USER_CACHE_DIR [as 别名]
def do_clear():
click.echo(crayons.white(fix_utf8("Clearing caches…"), bold=True))
try:
from pip._internal import locations
except ImportError: # pip 9.
from pip import locations
try:
vistir.path.rmtree(PIPENV_CACHE_DIR, onerror=vistir.path.handle_remove_readonly)
# Other processes may be writing into this directory simultaneously.
vistir.path.rmtree(
locations.USER_CACHE_DIR,
ignore_errors=environments.PIPENV_IS_CI,
onerror=vistir.path.handle_remove_readonly
)
except OSError as e:
# Ignore FileNotFoundError. This is needed for Python 2.7.
import errno
if e.errno == errno.ENOENT:
pass
raise
示例2: __init__
# 需要导入模块: from pip._internal import locations [as 别名]
# 或者: from pip._internal.locations import USER_CACHE_DIR [as 别名]
def __init__(self):
self.statefile_path = os.path.join(USER_CACHE_DIR, "selfcheck.json")
# Load the existing state
try:
with open(self.statefile_path) as statefile:
self.state = json.load(statefile)[sys.prefix]
except (IOError, ValueError, KeyError):
self.state = {}