Project file window is yellow in PyCharm(PyCharm 中的项目文件窗口为黄色)
问题描述
我正在使用 Windows 10 中的 PyCharm 2019 和 Django,这是我一年未打开的项目.项目文件窗口显示为黄色,这似乎是新的.这是什么意思以及如何让文件显示为白色.
I'm working with PyCharm 2019 and Django, in Windows 10 in a project that I haven't opened in a year. The Project files window is showing up as yellow, which seems new. What does this mean and how to I get the files to appear as white.
推荐答案
黄色背景通常意味着文件被排除在项目之外(也可能意味着文件是只读").
What the yellow background usually means is that the files are excluded form the project (it can also mean the files are "read-only").
这可能有几个原因,.idea
文件夹可能已损坏,您需要将其删除并重新创建项目.如果您的项目安装在 venv 中,有时源文件会被标记为只读(这意味着正在编辑的源文件是安装在 venv 中的版本).
This might happen for several reasons, the .idea
folder might have broken and you need to delete it and recreate the project. If your project is installed in a venv sometimes the source files are marked read-only (which means the source files being edited are the versions installed in the venv).
所以这里变得复杂了,因为它可能取决于项目本身的细节.
So here it gets complicated because it can depend on the specifics of the project itself.
这个问题我通常的步骤是:
My usual steps for this problem are:
关闭并重新打开项目.
Close and reopen the project.
查看将目录之一标记为源根目录是否会更改项目树中的文件颜色.(无论出于何种原因,文件可能已被标记为从项目中排除.)
See if marking one of the directories as sources root changes the file color in the project tree. (Files might have been marked as excluded from the project for whatever reason.)
只是为了帮助诊断问题,打开搜索并转到成本范围,查看这些目录与什么范围相关联.
Just to help diagnosing the issue, open a search and go to costum scopes, see what scope those directories are associated with.
检查文件权限是否为只读.如果您使用对这些文件没有编辑权限的用户帐户登录 PyCharm(或操作系统),就会发生这种情况.
Check if file permissions are read-only. This can happen if you logged into PyCharm (or the OS) with a user account that doesn't have editing permissions on those files.
删除 .idea
文件夹(以便 IDE 重新创建它)并使用这些文件创建一个新项目.(记得做好备份.)
Delete the .idea
folder (so the IDE recreates it) and create a new project with those files. (Remember to make a backup copy.)
这篇关于PyCharm 中的项目文件窗口为黄色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!