WinError when running a Python script from Sublime Text


WinError when running a Python script from Sublime Text



I have a file named test.py with the following contents:


test.py


print ("Welcome")



Running this in Sumblime Text results with the following error in output:


[WinError 2] The system cannot find the file specified
[cmd: ['C:\Users\Mark\AppData\Local\Programs\Python\Python35-32\Python.exe', '-u', 'C:\Users\Mark Kaganovich\Desktop\test.py']]
[dir: C:UsersMark KaganovichDesktop]
[path: C:Program Files (x86)Common FilesOracleJavajavapath;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program FilesJavajre1.8.0_171bin;C:UsersMark KaganovichAppDataLocalProgramsPythonPython37-32;C:UsersMark KaganovichAppDataLocalProgramsPythonPython37-32python.exe;C:UsersMark KaganovichAppDataLocalProgramsPythonPython37-32Scripts;C:UsersMark KaganovichAppDataLocalProgramsPythonPython37-32;C:UsersMark KaganovichAppDataLocalMicrosoftWindowsApps;]
[Finished]





Please do not post code as images
– U9-Forward
Jul 1 at 5:50





@Kaganovich I've edited your question, here is why: the code should not be in an image, the text should contain the code and other important information (e.g. the fact that sublime text is used is very important here), python-3 tag should not be used if the question is not specific to python 3, the title should say what the question is about, not just "help me" or something similar to that. See also stackoverflow.com/help/how-to-ask
– zvone
Jul 1 at 8:45




1 Answer
1



It seems your python path in environment variables is differ than python you ran.


environment variables



Your python path is:


python



C:UsersMark KaganovichAppDataLocalProgramsPythonPython37-32



But your command is searching for:



C:UsersMark KaganovichAppDataLocalProgramsPythonPython35-32



If you are sure that you have Python35-32 then just add it to environment variables.


Python35-32


environment variables



Here is instructions for adding python path to environment variables:


python


environment variables



How to add to the pythonpath in Windows?





Thank you, i change the command but its the same error
– Kaganovich Mark
Jul 1 at 6:00





@KaganovichMark run CMD and go to C:UsersMark KaganovichAppDataLocalProgramsPythonPython37-32 then run Python.exe from here and pass your python file path to it.
– Ali Shahrivarian
Jul 1 at 6:02



CMD


C:UsersMark KaganovichAppDataLocalProgramsPythonPython37-32


Python.exe


python


path





its all the same i already change my build system into ibb.co/jSqyhJ
– Kaganovich Mark
Jul 1 at 6:03





@KaganovichMark I seen your error pic. Still have wrong path in your environment. Your account name is just Mark instead of Mark Kaganovich. Check that.
– Ali Shahrivarian
Jul 1 at 6:04



path


Mark


Mark Kaganovich






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

C++ thread error: no type named ‘type’ MINGW

Decreasing a static image progress bar horizontally in SDL

How to input without newline? (Python)