@echo OFF title Python Module Upgrader (User) :: This will upgrade all the modules in the USER environment only, leaving :: the GLOBAL environment untouched - to avoid breaking Python. :: :: You can run this after installing the Chocolatey version of Python, or before :: setting up a new Python virtual environment with 'venv'. :: :: If you've just installed Python via Chocolatey, you could bring the GLOBAL :: environment up to date before you begin your first project: :: python -m pip install --upgrade pip setuptools REM Do OPENFILES to check for administrative privileges. openfiles >nul 2>&1 if not errorlevel 1 ( echo You can run this as a regular user. echo Simply double-click on the file. pause exit /b 1 ) REM Upgrade PIP. ::python -m pip install --upgrade pip --user REM Upgrades all of Python's PIP packages, presuming PIP is installed. for /F "delims==" %%A in ('python -m pip list --user --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 --user ) ) echo. pause