python调用库有波浪线,Anaconda / Python站点打包名称中带有波浪号的子文件夹-它们是什么?...

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

4c19603f31bafc33b33729692accc976.png

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

7ed7b50f3ebba9bddfd2d02ec1cbd179.png

~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?

解决方案

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).

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值