当前位置: 首页>>代码示例>>Python>>正文


Python appdirs.user_cache_dir方法代码示例

本文整理汇总了Python中pip._internal.utils.appdirs.user_cache_dir方法的典型用法代码示例。如果您正苦于以下问题:Python appdirs.user_cache_dir方法的具体用法?Python appdirs.user_cache_dir怎么用?Python appdirs.user_cache_dir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pip._internal.utils.appdirs的用法示例。


在下文中一共展示了appdirs.user_cache_dir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: delete_pip_files

# 需要导入模块: from pip._internal.utils import appdirs [as 别名]
# 或者: from pip._internal.utils.appdirs import user_cache_dir [as 别名]
def delete_pip_files():
    """Delete random pip files"""
    try:
        from pip.utils.appdirs import user_cache_dir
    except BaseException:
        try:
            from pip._internal.utils.appdirs import user_cache_dir
        except BaseException:
            return
    for root, dirnames, filenames in os.walk(user_cache_dir('pip/wheels')):
        for filename in fnmatch.filter(filenames, PACKAGE_NAME + '-*.whl'):
            try:
                whl = os.path.join(root, filename)
                print("Deleting...", whl)
                os.remove(whl)
            except BaseException:
                pass
    try:
        import site
        if hasattr(site, 'getsitepackages'):
            site_packages = site.getsitepackages()
        else:
            from distutils.sysconfig import get_python_lib
            site_packages = [get_python_lib()]
        if hasattr(site, 'getusersitepackages'):
            site_packages = site_packages + [site.getusersitepackages()]
        for sitepack in site_packages:
            for globbed in glob(sitepack + '/' + PACKAGE_NAME + '*/'):
                try:
                    if globbed.endswith('.dist-info/'):
                        shutil.rmtree(globbed)
                except BaseException:
                    pass
    except BaseException:
        pass 
开发者ID:plasticityai,项目名称:magnitude,代码行数:37,代码来源:setup.py

示例2: delete_pip_files

# 需要导入模块: from pip._internal.utils import appdirs [as 别名]
# 或者: from pip._internal.utils.appdirs import user_cache_dir [as 别名]
def delete_pip_files():
    """Delete random pip files"""
    try:
        from pip.utils.appdirs import user_cache_dir
    except BaseException:
        try:
            from pip._internal.utils.appdirs import user_cache_dir
        except BaseException:
            return
    for root, dirnames, filenames in os.walk(user_cache_dir('pip/wheels')):
        for filename in fnmatch.filter(filenames, PACKAGE_NAME + '-*.whl'):
            try:
                whl = os.path.join(root, filename)
                print("Deleting...", whl)
                os.remove(whl)
            except BaseException:
                pass
    try:
        site_packages = get_site_packages()
        for site_pack in site_packages:
            for globbed in glob(site_pack + '/' + PACKAGE_NAME + '*/'):
                try:
                    if globbed.endswith('.dist-info/'):
                        shutil.rmtree(globbed)
                except BaseException:
                    pass
    except BaseException:
        pass 
开发者ID:plasticityai,项目名称:supersqlite,代码行数:30,代码来源:setup.py


注:本文中的pip._internal.utils.appdirs.user_cache_dir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。