I'm new to python and have been learning how to use a virtual environment.
I followed the tutorial on youtube and created a virtual environment using this command:
python -m venv venv-testing
and tried to activate it using this command:
venv-testing\Scripts\activate.bat
I expected there was my virtual environment name in brackets that showed it activated, but it did nothing. It also didn't show error.
Can someone explain what exactly happened to me? I use Windows and PowerShell.
Thank you very much☺️
From PowerShell, you don't want to start the .bat.
You can, but that will start a new cmd process, in which your environment will activate, and then it will kill that process again.
Instead, you'll want to start the .ps1, i.e.:
venv-testing\Scripts\activate.ps1
This will activate the environment in your current PowerShell process, and the activation will persist after running the script.
Depending on your system's configuration, just running this may work:
venv-testing\Scripts\activate
But you may want to explicitly run the .ps1 instead, to avoid a situation where what you do works on some systems, but not on others.