Skip to content

Instantly share code, notes, and snippets.

@Xarkam
Created March 16, 2025 13:08
Show Gist options
  • Save Xarkam/d34aed759106b1cfbb6003ae47e44c0e to your computer and use it in GitHub Desktop.
Save Xarkam/d34aed759106b1cfbb6003ae47e44c0e to your computer and use it in GitHub Desktop.
Prepare downloaded python zip for obs
$currentPath = Get-Location
# Rename the file python312._pth to python312._pth.save to prevent malfunction
Rename-Item Path "$currentPath\python312._pth" -NewName "$currentPath\python312._pth.save"
#Get pip from https://bootstrap.pypa.io/get-pip.py
$url="https://bootstrap.pypa.io/get-pip.py"
$output="$currentPath\get-pip.py"
Invoke-WebRequest -Uri $url -OutFile $output
# Set python path
# This script sets the PYTHONPATH volatile environment variable to include the current directory and its subdirectories
# This script should be run from the directory containing the portable Python distribution
# This script should be run in the PowerShell command line
$portablePythonPath = "$currentPath
$currentPath\Scripts;
$currentPath\DLLs;
$currentPath\lib;
$currentPath\lib\plat-win;
$currentPath\lib\site-packages;
$currentPath\Libs"
write-host "Setting PYTHONPATH to $portablePythonPath"
Set-Variable PYTHONPATH $portablePythonPath -Option Volatile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment