I installed virtual env with sudo pip install virtualenv
but when I run python -m venv flask
I'm still getting this: /usr/bin/python: No module named venv
Versions, if that's relevant:
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)
Python 2.7.9
what am I missing here?
Since you are on Python 2, you need to execute using the virtualenv module that you installed.
First step, as you originally tried to do, but this time you specify the "virtualenv" module and the name of the virtualenv. In this case flask:
python -m virtualenv flask
Then you activate your virtualenv like this:
source flask/bin/activate
Then install flask with pip inside the virtualenv
pip install flask
If you want to deactivate your virtualenv, simply type:
deactivate
If running on Python 3, the venv
command is built-in and you can simply do:
python3 -m venv flask
Note, depending on how your Python 3 is installed, your python execution command might differ. You could be running it as python3
, python3.5
, python3.6
.