APK errors

PowerShell will not run the script

PowerShell writes: cannot be loaded because running scripts is disabled on this system. A virtual environment's Activate.ps1 file is a script, so PowerShell stops it. activate.bat in Command Prompt is not that script, and it runs.

Do not lift the block for the whole computer. Check the cause in order.

  • In Command Prompt, in the project folder, run .venv\Scripts\activate.bat. If the line shows (.venv), the environment is on. Do not change PowerShell.
  • If you want to stay in PowerShell, for your user only: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser. Close the window, open a new one, then run .venv\Scripts\Activate.ps1.
  • Do not write Unrestricted or LocalMachine. That opens other scripts on the whole computer.
  • If the MachinePolicy line stays Restricted, a user command does not pass it. Continue with activate.bat in that window.
  • The same sentence is for another .ps1 file. The file name changes. The stop is the same.

Do not write Bypass. For one job, activate.bat in Command Prompt is enough.

py -m venv .venv
.venv\Scripts\activate.bat

Related guides