-1

I try to install virtual environment using : python -m venv .venv

But it says it can't find a module called venv.

enter image description here

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Merry
  • 3
  • 1

2 Answers2

0

I have a feeling that you are using the default Python version 2.X. Try this to see if that is the case:

python --version

If the default is 2.X, then it does not come with the venv library. You need to explicitly call python3:

python3 -m venv .venv
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Hai Vu
  • 37,849
  • 11
  • 66
  • 93
-2

Execute first this line to install virtual-enviornment and than execute your line.

python -m pip install virtualenv
domx4q
  • 62
  • 6
  • 3
    There's nothing wrong with `python -m venv` (assuming Python 3) and doesn't address the error of actually using `venv` module. – OneCricketeer Jun 21 '22 at 20:18