Search code examples
pythonpycharm

Cannot run program error=2 No such file or directory in PyCharm


I was given a code at school to modulate for a research project, but first I would like to run it as it is, unmodulated. Its written in Python, and I use PyCharm CE on Ubuntu 18.04 with Python 2.7 ... I've chosen the correct interpreter in the project settings (I think. The path is /usr/bin/python2.7) and I get this Error Message:

Error running 'project': Cannot run program "C:/WinPython-64bit-2.7.9.1/python-2.7.9.amd64/python.exe" (in directory "/home/user/Documents/model"): error=2, No such file or directory

Why is PyCharm still looking for the Interpreter in the folder that, I'm assuming, the user before me used to put it?


Solution

  • You can fix this error by modifying the .idea/workspace.xml file. Search and remove any old interpreters and put the correct one.

    Answer inspired by Ryan Elfman's post: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206597295-Why-can-t-I-run-a-script-in-PyCharm-when-I-can-debug-it-I-get-CreateProcess-error-123