0

Trying to run simple Python code on Sublime Text editor but getting the following error:

[WinError 2] The system cannot find the file specified
[cmd: ['py', '-u', 'C:\\Users\\Administartor\\Desktop\\Python projects\\test.py']]
[dir: C:\Users\Administartor\Desktop\Python projects]
[path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\Administartor\anaconda3;C:\Users\Administartor\anaconda3\Library\mingw-w64\bin;C:\Users\Administartor\anaconda3\Library\usr\bin;C:\Users\Administartor\anaconda3\Library\bin;C:\Users\Administartor\anaconda3\Scripts;C:\Users\Administartor\AppData\Local\Microsoft\WindowsApps;C:\Users\Administartor\AppData\Local\Programs\Microsoft VS Code\bin;]
[Finished]

When I type Python in the command prompt I get the following message

Python 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32

Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated.  Libraries may fail to load.  To activate this environment
please see https://conda.io/activation

Type "help", "copyright", "credits" or "license" for more information.

I checked many other threads about this but I still can't find a solution to this problem.

I also have Jupyter notebook and Visual Studio Code and they are working without problems

Alex
  • 79
  • 1
  • 10
  • Can you remove the `space` in the path to your script and try again? – dragon2fly May 06 '22 at 10:57
  • I tried to rename the folder to Python_projects and run the script again but I'm still getting the same problem. Also tried creating a new file in the same folder but, same problem. Created another .py in a different folder but same problem – Alex May 06 '22 at 11:55
  • So what is the code that you are trying to run? – dragon2fly May 06 '22 at 13:35
  • Just a simple print("test") – Alex May 06 '22 at 13:53
  • Can you show your Sublime Text's `build system` commands? – dragon2fly May 07 '22 at 07:58
  • How can I do that? – Alex May 07 '22 at 13:16
  • the doc can guide you https://www.sublimetext.com/docs/build_systems.html – dragon2fly May 07 '22 at 14:57
  • I read through it but I can't find a way to "open" it. I navigated to C:\Users\Administartor\AppData\Roaming\Sublime Text\Packages\User and it's empty (if this is the correct folder) – Alex May 08 '22 at 01:27
  • The problem happens with SublimeText 4, while it works fine with SublimeText 3. Didn't think it could be important but I'm using Anaconda – Alex May 08 '22 at 05:56
  • 1
    Please check if `py.exe` is in `C:\Windows`. I doubt that Anaconda has that launcher. If it is not there, create a `C:\Windows\py.bat` that points to your Anaconda python – dragon2fly May 09 '22 at 03:42

0 Answers0