You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Activate.ps1 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. function global:deactivate ([switch]$NonDestructive) {
  2. # Revert to original values
  3. if (Test-Path function:_OLD_VIRTUAL_PROMPT) {
  4. copy-item function:_OLD_VIRTUAL_PROMPT function:prompt
  5. remove-item function:_OLD_VIRTUAL_PROMPT
  6. }
  7. if (Test-Path env:_OLD_VIRTUAL_PYTHONHOME) {
  8. copy-item env:_OLD_VIRTUAL_PYTHONHOME env:PYTHONHOME
  9. remove-item env:_OLD_VIRTUAL_PYTHONHOME
  10. }
  11. if (Test-Path env:_OLD_VIRTUAL_PATH) {
  12. copy-item env:_OLD_VIRTUAL_PATH env:PATH
  13. remove-item env:_OLD_VIRTUAL_PATH
  14. }
  15. if (Test-Path env:VIRTUAL_ENV) {
  16. remove-item env:VIRTUAL_ENV
  17. }
  18. if (!$NonDestructive) {
  19. # Self destruct!
  20. remove-item function:deactivate
  21. }
  22. }
  23. deactivate -nondestructive
  24. $env:VIRTUAL_ENV="C:\Users\Tobi\PycharmProjects\Cozmo_LineFollow\venv"
  25. if (! $env:VIRTUAL_ENV_DISABLE_PROMPT) {
  26. # Set the prompt to include the env name
  27. # Make sure _OLD_VIRTUAL_PROMPT is global
  28. function global:_OLD_VIRTUAL_PROMPT {""}
  29. copy-item function:prompt function:_OLD_VIRTUAL_PROMPT
  30. function global:prompt {
  31. Write-Host -NoNewline -ForegroundColor Green '(venv) '
  32. _OLD_VIRTUAL_PROMPT
  33. }
  34. }
  35. # Clear PYTHONHOME
  36. if (Test-Path env:PYTHONHOME) {
  37. copy-item env:PYTHONHOME env:_OLD_VIRTUAL_PYTHONHOME
  38. remove-item env:PYTHONHOME
  39. }
  40. # Add the venv to the PATH
  41. copy-item env:PATH env:_OLD_VIRTUAL_PATH
  42. $env:PATH = "$env:VIRTUAL_ENV\Scripts;$env:PATH"