Skip to content

Instantly share code, notes, and snippets.

@5shekel
Created September 24, 2023 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 5shekel/e85de3964900b3d6a3b00a49f64717bc to your computer and use it in GitHub Desktop.
Save 5shekel/e85de3964900b3d6a3b00a49f64717bc to your computer and use it in GitHub Desktop.
sample script you can use in PowerShell to iterate over all Conda environments and check if Jupyter and PyTorch are installed:
$condaenvs = (conda env list | Out-String) -split "`n"
foreach ($condaenv in $condaenvs) {
$name = $condaenv.Split(' ')[0]
if ($name -ne "" -and $name -ne "#") {
Write-Output "================================================================"
Write-Output "Environment: $name"
Write-Output "`nChecking for Jupyter:"
& cmd /c "call activate $name && jupyter --version"
Write-Output "`nChecking for Pytorch:"
& cmd /c "call activate $name && python -c `"import torch; print(torch.__version__)`""
Write-Output "================================================================"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment