Rename trader_req_win.ps to trader_req_win.ps1

v1
This commit is contained in:
alexpolo1
2023-11-20 08:29:24 +01:00
committed by GitHub
parent 286b9dcd7e
commit 9b3f6f7610

41
trader_req_win.ps1 Normal file
View File

@@ -0,0 +1,41 @@
# PowerShell script to install Python and required modules
# Check if Python is already installed
$pythonInstalled = $False
try {
$pythonInstalled = python --version
}
catch {
Write-Host "Python is not installed."
}
# Install Python if not already installed
if (-not $pythonInstalled) {
# Download Python installer
$pythonInstallerUrl = "https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe"
$pythonInstallerPath = "$env:TEMP\python_installer.exe"
Invoke-WebRequest -Uri $pythonInstallerUrl -OutFile $pythonInstallerPath
# Run Python installer
Start-Process $pythonInstallerPath -ArgumentList "/quiet InstallAllUsers=1 PrependPath=1" -Wait
Write-Host "Python installed successfully."
}
# Check if pip is installed
try {
pip --version
}
catch {
Write-Host "pip is not installed. Installing pip."
# Install pip
Invoke-Expression "python -m ensurepip"
}
# Install required Python packages
$requiredModules = @("requests", "Pillow", "pyautogui")
foreach ($module in $requiredModules) {
pip install $module
Write-Host "$module installed successfully."
}
Write-Host "Setup complete. Python and required modules are installed."