Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error running 'filename'. The system cannot find the file specified (PyCharm)

I have a PyCharm project on my Windows, where I am able to run most .py files by pressing Ctrl + Shift + F10 (or running the debugger). In one of the files however I get the error

Error running 'test':
Cannot run program  "\opt\anaconda\bin\python" (in directory "..."): CreateProcess error=2, the system cannot find the file specified.`

The test.py file right now only contains print('hello')

I can do this for the other files, and using 'Execute selection in console' also works fine. Given I am on a Windows machine the "\opt\anaconda\bin\python" part looks suspicious, but I don't know how to fix it.

Any help?


Copying the content to another file (e.g. test_2.py) 'fixes' the problem, but since this is a collaborative project this isn't viable.

like image 296
Toke Faurby Avatar asked Jan 29 '23 02:01

Toke Faurby


2 Answers

I think your case is cause by some project environment has changed. I suggest your open the workspace.xml which located in .idea\, check the parameters in it.

or you can delete the directory ".idea" and re-create the project locate in the original path.

Hope it work

like image 188
Ferom Avatar answered Jan 31 '23 11:01

Ferom


I had the same problem in PyCharm IDE and Windows after adding new libraries and some changes.

I recreated Run/Debug Configurations with these steps (Instead of recreating the whole of project!):

  1. Select Edit Configurations... from top panel in PyCharm IDE enter image description here

  2. Select these files and press delete for deleting them enter image description here

  3. Recreate these files likes this images:

    Click green arrow or press Ctrl + Shift + F10

enter image description here

like image 29
Alireza Mazochi Avatar answered Jan 31 '23 11:01

Alireza Mazochi