-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_in_venv.ps1
33 lines (28 loc) · 957 Bytes
/
run_in_venv.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
33
# HINT: If the current PowerShell execution policy
# does not allow running this script, execute
# the following command first:
#
# ```Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser```
# Activate the virtual environment
if (Test-Path .\env\Scripts\Activate.ps1) {
.\env\Scripts\Activate.ps1
} else {
Write-Host "Virtual environment not found. Please create it first." -ForegroundColor Red
exit 1
}
# Run the Python script
try {
python .\src\main_gui.py
} catch {
Write-Host "Failed to execute the Python script. Please check for errors." -ForegroundColor Red
exit 1
}
# Deactivate the virtual environment
if ($env:VIRTUAL_ENV) {
deactivate
Write-Host "Virtual environment deactivated." -ForegroundColor Green
} else {
Write-Host "No active virtual environment detected." -ForegroundColor Yellow
}
# Script completed
Write-Host "Script execution completed." -ForegroundColor Green