@echo OFF
title Python Environment Checker
:: Displays information about your current Python environment.
::
:: Administrator privileges are normally required for GLOBAL uninstallations
:: of modules:
:: python -m pip uninstall <package>
::
:: To uninstall all USER modules:
:: python -m pip freeze --user > "%TEMP%\requirements.txt"
:: python -m pip uninstall -r "%TEMP%\requirements.txt"
cls
set "TAB= "
REM Get the Python version.
for /f "tokens=2" %%V in ('python --version') do (
set "PV=%%V"
)
echo Basic information regarding your Python %PV% environment:
echo.
echo Install locations...
echo.
REM Get the Python location.
for /f "tokens=*" %%P in ('where python.exe') do (
set "PYTHON_LOCATION=%%P"
)
echo [PYTHON]%TAB%%PYTHON_LOCATION%
REM Get the Py location.
for /f "tokens=*" %%P in ('where py.exe') do (
set "PY_LOCATION=%%P"
)
echo [PY]%TAB%%TAB%%PY_LOCATION%
REM Get the PIP location.
for /f "tokens=*" %%P in ('where pip.exe') do (
set "PIP_LOCATION=%%P"
)
echo [PIP]%TAB%%TAB%%PIP_LOCATION%
echo.
echo The modules...
echo.
REM Show user "site-packages" location.
echo [USER]
python -m pip list --user
for /f "tokens=*" %%P in ('python -m site --user-site') do (
set "USER_SITE_PACKAGES=%%P"
)
echo [%USER_SITE_PACKAGES%]
echo.
REM Show global "site-packages" location.
echo [GLOBAL]
python -m pip list --local
for /f "tokens=*" %%N in ('python -c "import sysconfig; print(sysconfig.get_paths()['purelib'])"') do (
set "GLOBAL_SITE_PACKAGES=%%N"
)
echo [%GLOBAL_SITE_PACKAGES%]
echo.
pause
Comments
0 B
|👍
/👎