Trouble activating venv

I made a venv using py -m venv .
but then running py .\Scripts\activate just gives me this error:

What am I doing wrong?

The activation script is a shell script that sets up your shell, not a python script.

venv — Creation of virtual environments — Python 3.13.7 documentation shows the commands to use to activate the environment for different shells.

In general, you should not cd into a venv directory. You would do something like:

> py -m venv .venv
> .venv\Scripts\activate.ps1

Thank you. I was able to activate it by running .\test\Scripts\Activate.ps1 but only after running Set-ExecutionPolicy Bypass first. It works though!

1 Like