Hi, I´m totally new and illiterate about Python . I thankfull for any support. I´m self-learning following a book, I´m in the “getting started” chapter. Trying to use Sublime text to edit Python commands.
- I get WinError 2 message (see below details). I use Windows 7, Python 3.7.2 (identical to book)
- I´ve copied the book instructions:
------- details of error message---------->
[WinError 2] System cannot find specified file
[cmd: [‘python3’, ‘-u’, ‘D:\python\python_work\hello_world.py’]]
[path: C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\DTS\Binn;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\MINI-REFPROP;C:\Users\fontemelle\AppData\Local\Programs\Python\Python37\Scripts;C:\Users\fontemelle\AppData\Local\Programs\Python\Python37]
Click the Sublime Text icon to launch it, or search for Sublime Text in your system’s search bar and then launch it.
Go to Tools/ Build System/ New Build System, which will open a new configuration file for you.
Delete what you see and enter the following:
“cmd”: [“python3”, “-u”, “$file”],
This code tells Sublime Text to use your system’s python3 command when running your Python program files. Save the file as Python3.sublime-build in the default directory that Sublime Text opens when you choose Save.
Before you write your first program, make a folder called python_work somewhere on your system for your projects. It’s best to use lowercase letters and underscores for spaces in file and folder names, because Python uses these naming conventions.
Open Sublime Text, and save an empty Python file (File/Save As) called hello_world.py in your python_work folder. The extension .py tells Sublime Text that the code in your file is written in Python, which tells it how to run the program and highlight the text in a helpful way.
After you’ve saved your file, enter the following line in the text editor:
print(“Hello Python world!”)
If the python command works on your system, you can run your program by selecting Tools/ Build in the menu or by pressing cTrL-B .
If you had to configure Sublime Text in the previous section, select Tools/ Build System and then select Python 3.
From now on you’ll be able to select Tools/ Build or just press cTrL-B (or z-B) to run your programs.
A terminal screen should appear at the bottom of the Sublime Text window, showing the following output:
Hello Python world!
[Finished in 0.1s]
If you don’t see this output, something might have gone wrong in the program.