今天去改了matplotlib的配置。搜索 matplotlibrc
发现我有两个:
查看site-packages
文件夹,我发现很多包的名称中都有波浪号:
~klearn
是sklearn
,但是还有一个sklearn
。~atplotlib
也是matplotlib,更改日期是2018-11
~-tplotlib
的更改日期是2019-3.15
matplotlib
的更改日期是2019-3.28
(我最近更新了matplotlib)
这些波浪线名称包有什么用?我可以安全地删除它们吗?
最佳答案
您是否可能使用 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"
...
如果这就是这些文件的内容,那么您可以安全地删除它们。
关于python - 名称中带有波浪号的 Anaconda/Python 站 pip 包子文件夹 - 它们是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55565760/