Python venv not creating virtual environment

I have a Windows 10 machine and had a same problem. It was because I had multiple versions of python. Unknowingly windows had created a python.exe in the WindowsApps folder -

enter image description here

Then the solution is sometimes:(there is a huge chance that, the old %PATH% got renamed)

py -m venv venv

This python.exe had a size of 0 kb, so I deleted the python.exe in the WindowsApps folder, opened a new Command prompt and it started working.


Sometime system's path environment is not aware of virtualenv.exe

solution:
install virtualenv

pip install virtualenv  

run command in the directory where you want virtual environment :

python3 -m virtualenv venv