A comprehensive suite of PowerShell scripts to quickly switch between multiple versions of Python, CUDA, cuDNN, and Visual Studio BuildTools on your Windows machine. Each tool intelligently scans for existing installations and updates your system environment variables to prioritize the version you select.
Managing multiple development environment versions can be challenging. This toolkit automates the process of discovering installations and switching between them by manipulating environment variables and PATH settings. Perfect for developers working across multiple projects with different toolchain requirements.
- Scans multiple locations for Python installations
- Updates user PATH variable
- Works with Python Launcher (
py.exe) installations - No administrator privileges required
- Detects all NVIDIA CUDA Toolkit installations
- Updates
CUDA_PATHsystem variable - Manages system PATH for CUDA binaries
- Requires Administrator privileges
- Scans
C:\Program Files\NVIDIA\CUDNNfor versions - Updates system PATH for cuDNN binaries
- Requires Administrator privileges
- Finds all MSVC compiler installations (cl.exe)
- Supports VS 2019, 2022, and newer versions
- Updates
cl.exesystem variable and PATH - Requires Administrator privileges
- Unified menu interface for all switchers
- Quick access to any tool
- Streamlined workflow
- ๐ฅ๏ธ Windows Operating System: Windows 10/11 recommended
- ๐ต PowerShell: Pre-installed on modern Windows
- ๐ Administrator Rights: Required for CUDA, cuDNN, and VS BuildTools switchers
- ๐ฆ At least one version installed: For each tool you want to use
- Download all files to the same directory
- Double-click
start.bat - Select the tool you want to use from the menu:
========================================
Environment Version Switcher
========================================
1. Python Version Switcher
2. CUDA Version Switcher (Requires Admin)
3. cuDNN Version Switcher (Requires Admin)
4. VS (BuildTools) Version Switcher (Requires Admin)
0. Exit
========================================
Select an option [0-4]:
You can also run each switcher independently by double-clicking its .bat file:
python_switcher.batcuda_switcher.batcudnn_switcher.batvs_buildtools_switcher.bat
Features:
- Scans
%LOCALAPPDATA%\Programs\Python,%ProgramFiles%, and system directories - Detects Python Launcher installations
- Updates user PATH (no admin needed)
- Removes duplicate entries before adding selected version
Example Output:
Found 3 Python installation(s):
1. Python 3.12.0 - C:\Users\YourUser\AppData\Local\Programs\Python\Python312
[User Installation]
2. Python 3.11.5 - C:\Users\YourUser\AppData\Local\Programs\Python\Python311
[User Installation]
3. Python 3.9.13 - C:\Program Files\Python39
[System Installation]
0. Exit without changes
Features:
- Detects versions via
CUDA_PATH_V*_*environment variables - Updates
CUDA_PATHsystem variable - Cleans old CUDA paths from system PATH
- Adds
bin,libnvvp,bin\x64, andextras\CUPTI\lib64folders - Verifies installation with
nvcc --version
Example Output:
Found 2 CUDA installation(s):
1. CUDA v13.1 - C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1
2. CUDA v11.8 - C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8
0. Exit without changes
Admin Required: โ This tool modifies system environment variables.
Features:
- Scans
C:\Program Files\NVIDIA\CUDNN - Removes old cuDNN paths from system PATH
- Adds selected version's
binfolder to PATH
Example Output:
Found 2 cuDNN installation(s):
1. cuDNN v9.0.0.312_cuda12 - C:\Program Files\NVIDIA\CUDNN\v9.0.0.312_cuda12\bin
2. cuDNN v8.9.7.29_cuda11 - C:\Program Files\NVIDIA\CUDNN\v8.9.7.29_cuda11\bin
0. Exit without changes
Admin Required: โ This tool modifies system environment variables.
Features:
- Scans both
Program FilesandProgram Files (x86) - Finds all VS editions (BuildTools, Community, Professional, Enterprise)
- Supports VS 2019, 2022, and future versions
- Sets
cl.exesystem variable - Uses
Hostx64\x64for native 64-bit compilation
Example Output:
Found 2 installation(s):
1. v14.44.35207 - 2022 BuildTools
Path: C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64
2. v14.39.33519 - 2022 Community
Path: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64
0. Exit without changes
Admin Required: โ This tool modifies system environment variables.
- โ CUDA Switcher - Modifies system variables
- โ cuDNN Switcher - Modifies system variables
- โ VS BuildTools Switcher - Modifies system variables
- โ Python Switcher - Only modifies user PATH
When admin is required, the .bat launcher will automatically request elevation via UAC prompt.
- Python Switcher: Modifies
PATHfor current user only - CUDA/cuDNN/VS Switchers: Modify system-wide variables (all users)
After switching versions:
- Close and reopen all Command Prompts, PowerShell windows, and IDEs
- For CUDA/VS tools: If changes don't take effect, reboot Windows
- Current session: The script updates the current terminal for immediate testing
- โ Confirmation prompt before making changes
- โ Shows exactly what will be modified
- โ Removes old/duplicate paths to prevent conflicts
- โ Only adds folders that actually exist on disk
- โ Graceful error handling with clear messages
- Ensure the software is installed in standard locations
- For CUDA: Check if
CUDA_PATH_V*_*environment variables exist - For cuDNN: Check
C:\Program Files\NVIDIA\CUDNN - For VS: Check
C:\Program Files\Microsoft Visual Studio
- Restart your terminal/IDE completely
- Open a new Command Prompt or PowerShell window
- For system variables (CUDA/VS), try rebooting Windows
- Right-click the
.batfile - Select "Run as administrator"
- Or use the master launcher which handles elevation automatically
- The
.batlaunchers use-ExecutionPolicy Bypassflag - This bypasses policy for just that session (safe)
- No permanent system changes needed
Environment-Switcher/
โโโ start.bat # Master launcher menu
โโโ python_switcher.bat # Python launcher
โโโ python_switcher.ps1 # Python core script
โโโ cuda_switcher.bat # CUDA launcher
โโโ cuda_switcher.ps1 # CUDA core script
โโโ cudnn_switcher.bat # cuDNN launcher
โโโ cudnn_switcher.ps1 # cuDNN core script
โโโ vs_buildtools_switcher.bat # VS BuildTools launcher
โโโ vs_buildtools_switcher.ps1 # VS BuildTools core script
โโโ README.md # This file
- Automatically removes duplicate entries
- Validates folder existence before adding to PATH
- Prioritizes selected version at the top of PATH
- Preserves other environment variables
- Not hardcoded to specific versions
- Works with Python 3.x, CUDA 11.x/12.x/13.x+, any VS version
- Automatically adapts to new installations
- Version detection via folder scanning and registry checks
- Color-coded console output for clarity
- Clear version numbers and paths displayed
- Numbered selection menus (no typing long paths)
- Confirmation prompts to prevent accidents
- Immediate verification of changes
These scripts modify your system's environment variables. While designed to be safe and include multiple confirmation steps, please use at your own risk. Always understand what a script does before running it with administrator privileges.
Best Practice: Test on a non-critical machine first if you're uncertain.
- v2.0 - Complete toolkit with master launcher
- v1.2 - Added VS BuildTools switcher
- v1.1 - Added CUDA and cuDNN switchers
- v1.0 - Initial Python version switcher
Found a bug or have a feature request? Feel free to open an issue or submit a pull request!
MIT License - Feel free to use, modify, and distribute as needed.
Made with โค๏ธ for developers who need to juggle multiple environment versions