Anaconda/Python sitepackages子文件夹的名称是什么?

2024-05-23 18:37:02 发布

您现在位置:Python中文网/ 问答频道 /正文

今天,我去修改matplotlib的配置。搜索matplotlibrc发现我有两个:

Screenshot of search results, with two entries: <code>C:\Anaconda3\Lib\site-packages\~-tplotlib\mpl-data</code> and <code>C:\Anaconda3\Lib\site-packages\matplotlib\mpl-data</code>

查看site-packages文件夹,我发现很多包的名称中都有一个波浪号:

Windows Explorer screenshot showing that site-packages contains many other folders starting with a <code>~</code> symbol, like <code>~klearn</code> and <code>~yximport</code>

  • ~klearn是{},但还有一个{}。在
  • ~atplotlib也是matplotlib,更改日期是2018-11
  • ~-tplotlib的更改日期是2019-3.15
  • matplotlib的更改日期是2019-3.28(我最近确实更新了matplotlib)

这些tilde name包是用来做什么的?我可以安全地删除它们吗?在


Tags: name文件夹名称matplotlibpackagessitetildeklearn
1条回答
网友
1楼 · 发布于 2024-05-23 18:37:02

你有没有可能用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"

    ...

如果这些文件就是这样的,那么您可以安全地删除它们。在

相关问题 更多 >