@echo OFF title Python Module Upgrader (Admin) :: This will upgrade all the modules in the GLOBAL environment. :: :: You can run this after installing the Chocolatey version of Python, or before :: setting up a new Python virtual environment with 'venv'. REM Do OPENFILES to check for administrative privileges. openfiles >nul 2>&1 if errorlevel 1 ( color cf echo Right-click on this file and select "Run as administrator". pause color exit /b 1 ) REM Upgrade PIP. python -m pip install --upgrade pip REM Upgrades all of Python's PIP packages, presuming PIP is installed. for /F "delims==" %%A in ('python -m pip list --format freeze') do ( REM Package name to skip and exclude from upgrading. if not "%%A" == "pip" ( REM Upgrade package. python -m pip install --upgrade %%A ) ) echo. pause