Overview
The Python Setup options control which Python interpreter is used to run your scripts. You can use the Windows Python Launcher (py.exe), a specific Python installation, or even a portable Python distribution.
Configuration Options
Specifies the Python version to use when
pythondir is set to py or py.exe. This parameter is passed to the Windows Python Launcher to select the appropriate installed version.Valid values:3.11- Python 3.11.x3.10- Python 3.10.x3.9- Python 3.9.x3- Latest Python 3.x version2- Latest Python 2.x version (if installed)
This setting is ignored if
pythondir points to a specific Python executable.Defines the Python executable or launcher command to use. This is the most flexible configuration option for Python setup.Valid values:
py- Use Windows Python Launcher (recommended)py.exe- Explicit Windows Python Launcher pathpython- Use system PATH Pythonpython.exe- Explicit system PythonC:\Python311\python.exe- Absolute path to specific installation%cd%\python\python.exe- Relative path to portable Python
Usage Examples
Using Windows Python Launcher (Recommended)
The Windows Python Launcher (py.exe) is the recommended approach as it allows easy version switching:
Using a Specific Python Installation
If you need to use a specific Python installation, provide the full path:Using Portable Python
For portable Python distributions that live within your project directory:%cd% variable represents the current directory where the batch file is located.
Using System PATH Python
If you have Python in your system PATH:Version Selection Details
How pythonversion Works
When usingpy or py.exe as the pythondir, the launcher uses the Windows Python Launcher’s version selection:
Checking Installed Versions
To see which Python versions are available on your system:Common Configurations
Latest Python 3
Specific Minor Version
Development Environment
Legacy Project
Troubleshooting
Python Not Found
If you see “No python version was found!”, check:- Is Python installed? Run
py --versionin a command prompt - Is the version available? Run
py --listto see installed versions - Is the path correct? Verify absolute paths exist
- Is py.exe available? The Windows Python Launcher comes with Python 3.3+
Wrong Python Version Running
If the wrong version executes:- Verify
pythondiris set topyorpy.exe - Check that
pythonversionmatches an installed version - Run
py --listto confirm the version is available - Try using the full version number (e.g.,
3.11.5instead of3.11)
Portable Python Issues
If portable Python fails to run:- Verify the path is correct (check for typos)
- Ensure
python.exeexists at the specified location - Use absolute paths if relative paths aren’t working
- Check that the portable Python distribution is complete
The
alertifpynotinstalled configuration option (see Window Options) controls whether users are directed to download Python if it’s not found.Best Practices
Use Windows Python Launcher
When possible, usepy with pythonversion rather than direct paths. This provides:
- Easy version switching
- Better compatibility across machines
- Automatic selection of latest patch versions
Document Version Requirements
Add comments explaining why specific versions are required:Test Multiple Versions
If your project should support multiple Python versions, create separate launcher files:PythonLauncher-3.11.batPythonLauncher-3.10.batPythonLauncher-3.9.bat
Team Consistency
For team projects, commit the launcher configuration to version control and document the required Python version in your README.Related Configuration
- Virtual Environment - Automatic venv creation works with any Python setup
- Window Options - Control what happens if Python is not found