How do I automate this manual virtual environment Python step from a tutorial?

I'm trying to follow a machine learning tutorial where the presenter uses a Jupyter Notebook. However, I want to automate this process down to just running a single a python script.

The example commands are as follows:

Step 1. Clone this repository: https://github.com/nicknochnack/TFODCourse

Step 2. Create a new virtual environment

python -m venv tfod

Step 3. Activate your virtual environment

source tfod/bin/activate # Linux
.\tfod\Scripts\activate # Windows 

Step 4. Install dependencies and add virtual environment to the Python Kernel

python -m pip install --upgrade pip
pip install ipykernel
python -m ipykernel install --user --name=tfodj

Step 5. Collect images using the Notebook 1. Image Collection.ipynb - ensure you change the kernel to the virtual environment as shown below

I'm on windows with Python3 installed and executing the following script:

from subprocess import check_output
cmd1 = check_output("python -m venv tfod")
print(cmd1)
cmd2 = check_output(".\\tfod\\Scripts\\activate")
print(cmd2)

but getting the error:

PS C:\Users\jonat\documents\github\tfodcourse-main> python3 setup.py
b''
Traceback (most recent call last):
  File "C:\Users\jonat\documents\github\tfodcourse-main\setup.py", line 5, in <module>
    cmd2 = check_output(".\\tfod\\Scripts\\activate")
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 193] %1 is not a valid Win32 application

The tfod virtual environment directory does get created before the error but I'm guessing mouting the venv is problematic doing things this way. The reason I want to use the virtual environment approach he suggests is so I can create an application that does these steps in the background and streamlines the process. Maybe I misunderstood the importance of a virtual environment and can actually skip this step.

How can I make this work all from one script?