Installing Python and Miniconda on Windows PowerShell.

id.241017155.452718

Here’s a block of commands for installing Python and Miniconda on Windows PowerShell, and then creating an environment named env001:

# Step 1: Install Python
# Download the Python installer
Invoke-WebRequest -Uri https://www.python.org/ftp/python/3.11.5/python-3.11.5-amd64.exe -OutFile python-installer.exe
# Run the installer silently (adjust path if needed)
Start-Process -Wait -FilePath .\python-installer.exe -ArgumentList '/quiet InstallAllUsers=1 PrependPath=1'

# Step 2: Verify Python Installation
python --version

# Step 3: Install Miniconda
# Download Miniconda installer
Invoke-WebRequest -Uri https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -OutFile miniconda-installer.exe
# Run the Miniconda installer silently
Start-Process -Wait -FilePath .\miniconda-installer.exe -ArgumentList '/S /D=C:\Miniconda3'

# Step 4: Update Path (Run in a new PowerShell session if Miniconda isn't recognized)
$env:Path += ";C:\Miniconda3;C:\Miniconda3\Scripts;C:\Miniconda3\condabin"
conda --version

# Step 5: Create Environment env001
conda create -n env001 python=3.11 -y
conda activate env001

# Step 6: Confirm Environment is Active
python --version

This script will set up Python, Miniconda, and a new conda environment named env001. Run each block in sequence to ensure the installations proceed smoothly.