Install Python
Download Python [python-3.10.5-amd64.exe] to:
C:\dev\python\
Choose Customize Installation
Enable only:
pip
tcl/tk and IDLE
Disable all options and install to a known specific location:
C:\dev\python\install
Set PATH
Copy the location of python's Scripts:
C:\dev\python\install\Scripts
Open Advanced System Properties from Run:
SystemPropertiesAdvanced
Edit 'Path' variable from 'Use variables for Chikkala'
Add New
Paste the location of python Scripts
Open a new Command Prompt window and type:
echo %PATH%
Installing Virtual Environment
Open Command Prompt
Navigate to python's Scripts directory:
cd /d C:\dev\python\install\Scripts
Install Virtual Environment:
pip install virtualenv
Create Virtual Environment
virtualenv c:\dev\python\pyEnv\
Setup Sublime's Build System
Tools → Build System → New Build System...
Default Script:
{
"shell_cmd": "make"
}
Change this to:
{
"cmd": ["C:/dev/python/install/python.exe", "$file"],
"selector": "source.python",
"file_regex": "^\\s*File \"(...*?)\", line ([0-9]*)"
}
or to set the build system to use python's virtual environment, set it to:
{
"cmd": ["C:/dev/python/pyEnv/Scripts/python.exe", "$file"],
"selector": "source.python",
"file_regex": "^\\s*File \"(...*?)\", line ([0-9]*)"
}
Save it as 'Python_Build' under:
C:\Users\%USERNAME%\AppData\Roaming\Sublime Text\Packages\User
Test Python Script
Create a python test script:
print('test')
Save it!
Set the Build System in:
Tools → Build System → Python_Build
Build [Ctrl + B] !
Comments