简体   繁体   中英

WinError when running a Python script from Sublime Text

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

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:\Users\Mark Kaganovich\Desktop]
[path: C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jre1.8.0_171\bin;C:\Users\Mark Kaganovich\AppData\Local\Programs\Python\Python37-32;C:\Users\Mark Kaganovich\AppData\Local\Programs\Python\Python37-32\python.exe;C:\Users\Mark Kaganovich\AppData\Local\Programs\Python\Python37-32\Scripts\;C:\Users\Mark Kaganovich\AppData\Local\Programs\Python\Python37-32\;C:\Users\Mark Kaganovich\AppData\Local\Microsoft\WindowsApps;]
[Finished]

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

Your python path is:

C:\\Users\\Mark Kaganovich\\AppData\\Local\\Programs\\Python\\Python37-32

But your command is searching for:

C:\\Users\\Mark Kaganovich\\AppData\\Local\\Programs\\Python\\Python35-32

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

Here is instructions for adding python path to environment variables :

How to add to the pythonpath in Windows?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM