I recently got the code of a Pycharm project from my classmate, and then opened it on my computer and reported an error: Cannot load module file xxx.iml: File xxx.iml doed not exist. Would you like to remove module’xxxx’ from the project? At this time, the directory structure of the entire project is incomplete, and some files cannot be displayed. The reason for the correction may be that the project name was changed by the classmate when he gave me the project, or the project he gave me was not at the same level as the project directory he used (for example, what he copied to me was under a large project code Subprojects), causing problems.
There are two final solutions:
One way is to click File in the upper left corner of the Pycharm software, then click Invalidate Caches / Restart…, and then click Invalidate and Restart after the pop-up dialog box to wait for the project to reload, the problem is solved.
Another method is to delete the .idea folder in the project directory when the project is closed, and then reopen the problem with Pycharm to solve the problem. In addition, some friends may use Pycharm under the Linux platform. The .idea folder is hidden and cannot be seen directly. Then you can use the la command to view the files under the project, and then execute the command rm -r .idea.