-
Notifications
You must be signed in to change notification settings - Fork 1
/
add_anaconda.ps1
32 lines (24 loc) · 1.14 KB
/
add_anaconda.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function Write-Log {
param (
$message
)
$formattedTime = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
Write-Host "$formattedTime init_vm: $message"
}
$BUILD_DIRECTORY="C:\BuildArtifacts"
$INSTALL_DIRECTORY="C:\Software"
Set-Location -Path $BUILD_DIRECTORY
# ANACONDA
$ANACONDA_VERSION="2024.06-1"
$ANACONDA_INSTALLER_FILE="Anaconda3-$ANACONDA_VERSION-Windows-x86_64.exe"
$ANACONDA_DOWNLOAD_URL="https://repo.anaconda.com/archive/$ANACONDA_INSTALLER_FILE"
$ANACONDA_INSTALL_PATH="$INSTALL_DIRECTORY\Anaconda3"
$ANACONDA_INSTALL_ARGS="/InstallationType=AllUsers /RegisterPython=0 /S /D=$ANACONDA_INSTALL_PATH"
Write-Log "Downloading Anaconda installer..."
Invoke-WebRequest -Uri $ANACONDA_DOWNLOAD_URL -UseBasicParsing -OutFile "$BUILD_DIRECTORY\$ANACONDA_INSTALLER_FILE"
Write-Log "Installing Anaconda..."
Start-Process "$BUILD_DIRECTORY\$ANACONDA_INSTALLER_FILE" -ArgumentList $ANACONDA_INSTALL_ARGS -Wait
# PATH
Write-Log "Add Anaconda to PATH environment variable"
[Environment]::SetEnvironmentVariable("PATH", "$Env:PATH;$ANACONDA_INSTALL_PATH\condabin", [EnvironmentVariableTarget]::Machine)
Write-Log "add_anaconda script completed"