PyCharm缓存将C盘挤爆?一招帮你从根本上解决(超详细)
起因
我工作每天都需要和IDE 打交道,我用的是PyCharm,因为其便利性,让我爱不释手,但是其缓存一直在C 盘日积月累,加上最近用上了WSL2,大缓存的问题日益严峻,直到C 盘已经快崩了,上图:图片
我去查了一下PyCharm 缓存文件,不查不知道,一查吓一跳,竟然有足足 26 个G!图片
解决方法我查阅了网上很多的资料,解决方法都停留在几年前的了,直觉让我知道,过去的方法不是很靠谱,但是我知道了一个重要的信息:需要修改idea.properties 文件。
遵循有疑问就去官网查文档的习惯,我去到官网输入关键词 idea.properties进行搜索 ,找到了我需要的答案(附上官网链接:Platform properties):From the main menu, select Help | Edit Custom Properties.如图:
图片
点击之后,会弹出这个编辑窗口,如果以前没修改过,弹出来是空白的:图片
那怎么修改呢?我们继续看文档,文档列举了4个文件夹,分别是Configuration directorySystem directoryPlugins directoryLogs directory文档里面可以看到每个文件的默认路径,其中 JonhS是用户名,替换你自己的用户名就可以了。
图片
图片
细心观察可以发现,文件夹分为两类,一类是存放在Local 文件夹中,另外一类是存放在 Roaming 中,我看了下Roaming 文件夹中的文件,只有100M 左右,我主要的缓存都在 Local中,故我只需要挪动Local\JetBrains\PyCharm2021.3文件夹就行了,然后配置存放在Local中的文件路径,即idea.system.path和idea.log.path。保险起见,我将存放在Roaming 文件夹中的文件(idea.config.pat 和idea.plugins.path)也配置了原本的绝对路径。综上所述,我的配置如下 (注意:Windows 系统路径要使用/ !!!):#----------------------------------------------------------# Uncomment this option if you want to customize a path to the settings directory.#----------------------------------------------idea.config.path=C:/Users/HinGwenWoong/AppData/Roaming/JetBrains/PyCharm2021.3#-----------------------# Uncomment this option if you want to customize a path to the caches directory.#---------------------------------------------------idea.system.path=G:/Software_caches/JetBrains/PyCharm2021.3#------------------------------------------------------# Uncomment this option if you want to customize a path to the user-installed plugins directory.#--------------------idea.plugins.path=C:/Users/HinGwenWoong/AppData/Roaming/JetBrains/PyCharm2021.3/plugins#---------------------------------# Uncomment this option if you want to customize a path to the logs directory.#--------------------------------idea.log.path=G:/Software_caches/JetBrains/PyCharm2021.3/log
保存之后,退出 PyCharm,然后将Local\JetBrains\PyCharm2021.3 移动到{idea.system.path} ,启动PyCharm 看看是否有问题(如果有问题一般会弹出提示)。如果没问题就是正常打开,不需要选择什么配置,就像以前那样丝滑就是证明没问题。
图片
确认没问题的话,最后一步就是 释!放!空!间!
图片
顿时清爽!成功!图片
总结以上就是从根本上解决PyCharm缓存将C盘挤爆的问题,希望各位的磁盘永远不会被挤爆。感谢! 本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报。