pycharm: Error running ‘main’:Cannot run program

created at 02-13-2022 views: 42


Error when pycharm runs the project

error when running project in pycharm

As shown in the figure, because the previous operation was successful, after a long time, the error in the above figure appeared, sad. . .

I have searched online for a long time and have not solved my problem.

Suddenly, I thought to myself that it might be the problem that the path of the compiler was changed, and then I naturally thought that the first running will generate a record document, similar to XML, and it will has an impact on the second, third running and so on.

So try to open the workspace.xml file in the .idea folder in the project root directory.


Sure enough, the path recorded here is inconsistent with my compiler path. I installed it under the D/ disk, but the record here is under the C/ disk (it should be left over from the last run).


The next step is very easy, delete and restart the project, a new workspace.xml will be automatically generated.

So far, perfect solution.

created at:02-13-2022
edited at: 02-13-2022: