anaconda / python有名称为tilde的软件包,它们是什么?

时间:2019-04-08 03:13:56

标签: python pip anaconda python-packaging

今天,我想更改matplotlib的配置。 搜索matplotlibrc有两个:

enter image description here

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

a

  • ~klearnsklearn,但是还有另一个sklearn
  • ~atplotlib也是matplotlib,更改日期为2018-11
  • ~-tplotlib的更改日期是2019-3.15
  • matplotlib的更改日期是2019-3.28(我最近确实更新了matplotlib)

我只是想知道这些波浪符号名称包用于(回滚?),我可以安全地删除它们吗?

1 个答案:

答案 0 :(得分:3)

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

我翻阅了pip源代码,发现this snippet显然仅用于卸载软件包:

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"

    ...

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