pip – Why is python saying I have no module named venv?

pip – Why is python saying I have no module named venv?

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.

venv is a module introduced in python3

venv is New in version 3.3.

pip – Why is python saying I have no module named venv?

The venv is ony available in python 3 version. If you are using python 2 then try to use virtualenv instead of venv.

1. Install virtualenv,

python -m pip install virtualenv

2. Create a virtual environment named venv using virtualenv,

Python 2

python -m virtualenv venv

Python3

python -m venv venv

3. Activate virtual environment,

.venvScriptsactivate.bat

4. Install flask package,

pip install flask

Leave a Reply

Your email address will not be published. Required fields are marked *