Skip to content

Instantly share code, notes, and snippets.

@5shekel
Created September 24, 2023 06:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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