Anaconda/Python站点打包名称中带有波浪号的子文件夹-它们是什么? [英] Anaconda/Python site-packages subfolders with tilde in name - what are they?

查看:290
本文介绍了Anaconda/Python站点打包名称中带有波浪号的子文件夹-它们是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,我去更改了matplotlib的配置.搜索matplotlibrc显示我有两个:

Today, I went to change the config of matplotlib. Searching matplotlibrc revealed I have two of them:

site-packages文件夹中,我发现很多软件包的名称中都带有波浪号:

Looking at the site-packages folder, I found a lot of packages have a tilde in their name:

  • ~klearnsklearn,但是还有另一个sklearn.
  • ~atplotlib也是matplotlib,更改日期为2018-11
  • ~-tplotlib的更改日期是2019-3.15
  • matplotlib的更改日期是2019-3.28(我最近更新过matplotlib)
  • ~klearn is sklearn , but there is another sklearn .
  • ~atplotlib is matplotlib too, changed date is 2018-11
  • ~-tplotlib's changed date is 2019-3.15
  • matplotlib's changed date is 2019-3.28 (I did update matplotlib recently)

这些波浪号名称包用于什么用途?我可以安全地删除它们吗?

What are these tilde name packages used for? Can I delete them safely?

推荐答案

是否有可能使用pip安装了那些特定的软件包?如果是这样,则损坏的目录可能是pip在卸载软件包时(或在卸载软件包以准备更新软件包时)创建的临时目录.

Is it possible that you installed those particular packages with pip? If so, then the mangled directories are probably the temporary directories that pip creates when it uninstalls a package (or when it uninstalls a package in preparation for updating a package).

我翻阅了pip源代码,发现

I dug through the pip source code and found this snippet which is evidently only used on uninstalling packages:

class AdjacentTempDirectory(TempDirectory):
    """Helper class that creates a temporary directory adjacent to a real one.
    Attributes:
        original
            The original directory to create a temp directory for.
        path
            After calling create() or entering, contains the full
            path to the temporary directory.
        delete
            Whether the directory should be deleted when exiting
            (when used as a contextmanager)
    """
    # The characters that may be used to name the temp directory
    # We always prepend a ~ and then rotate through these until
    # a usable name is found.
    # pkg_resources raises a different error for .dist-info folder
    # with leading '-' and invalid metadata
    LEADING_CHARS = "-~.=%0123456789"

    ...

如果这就是这些文件,则可以安全地删除它们.

If that's what these files are, then you can safely delete them.

这篇关于Anaconda/Python站点打包名称中带有波浪号的子文件夹-它们是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆