PyCharm 2021.1.1:无法从文件错误加载设置 [英] PyCharm 2021.1.1 : Cannot load settings from file error
问题描述
每当我打开 PyCharm 时,我都会收到 2 个警告,如下图中的红色标记:
Whenever I open PyCharm I get 2 warnings as marked with red in the image below :
警告是:
加载设置
无法从文件F:\Restframework\.idea\Restframework.iml"加载设置:文件 F:\Restframework.idea\Restframework.iml 不存在请更正文件内容
Cannot load settings from file 'F:\Restframework\ .idea\Restframework.iml':File F:\Restframework.idea\Restframework.iml does not exist Please correct the file content
和
加载设置
无法从文件P:\Website Codes\Restframework\.idea\Restframework.iml"加载设置:文件 P:\Website Codes\Restframework.idea\Restframework.iml 不存在请更正文件内容
Cannot load settings from file 'P:\Website Codes\Restframework\ .idea\Restframework.iml':File P:\Website Codes\Restframework.idea\Restframework.iml does not exist Please correct the file content
我的笔记本电脑中没有任何 F:
驱动器,并且在 P:
驱动器的 Website Codes
文件夹中没有 Restframework
文件夹.那么,为什么我会收到这样的警告以及我应该怎么做才能避免这些警告??
I don't have any F:
drive in my laptop and in Website Codes
folder in P:
drive there is no Restframework
folder. So , why I'm getting such warnings and what I'm supposed to do to avoid these warnings ??
推荐答案
错误信息:
加载设置
无法从文件 (...) 加载设置
Cannot load settings from file (...)
是说在 每个项目的.idea
文件夹.(发生这种情况的原因有很多,项目文件被移动,驱动器号改变,.idea
文件夹从计算机复制到另一台具有不同路径的计算机等......)
is saying that the projects cannot be found at the paths specified in the settings files in each project's .idea
folder. (This can happen for lots of reasons, the project files were moved, the drive letter changed, the .idea
folder was copied from computer to another that has different paths, etc...)
在解决问题之前,了解项目在 PyCharm 中的工作方式很重要.每个项目都定义了 1 个 .idea
文件夹(如上述链接中所述).但是您可以在一个窗口中使用打开多个项目附加项目"这会导致第一个项目的 工作区中有 1 个条目.xml
文件添加到每个附加的项目(请注意,每个单独的项目仍然有自己的 .idea
文件夹,其中包含自己的设置文件).
Before solving the problem it's important to understand how projects work in PyCharm. Each project is defined by having 1 .idea
folder (as explained in the above link). But you can open multiple projects in one window using "Attach Project" which causes 1 entry in the 1st project's workspace.xml
file to each attached project (take notice that each individual project still has its own .idea
folder with its own setting files in it).
您可以通过多种方式解决此问题.首先尝试从视图中删除项目为了摆脱可能导致错误的项目,这将删除对附加项目"的引用.来自第一个项目.
You can fix this in several ways. First try to Delete a project from view to get rid of the projects that might be causing the error, this removes references to "Attached Projects" from the 1st project.
如果之后仍有项目导致这些错误,您可以尝试修复 每个项目的设置文件.一种方法是删除每个项目中的 .idea
文件夹并重新打开该项目,以便 PyCharm 重新创建该文件夹(在删除之前备份该文件夹).您也可以尝试打开设置文件并尝试修复其中的路径(这是一个更复杂的解决方案,需要能够理解设置文件的内容).
If afterwards there are still projects causing these errors you can try to fix the settings files of each individual project. One way of doing this is deleting the .idea
folder in each project and reopening the project so PyCharm recreates the folder (backup the folder before deleting). You can also try to open the settings files and try to fix the paths inside them (this is a more complicated solution that requires being able to understand the contents of the settings files).
这篇关于PyCharm 2021.1.1:无法从文件错误加载设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!