Why is "virtualenv venv" not working on Ubuntu 18.04? [duplicate]

I'm having trouble creating a virtual environment for python on my Ubuntu desktop. I have installed virtualenv by: sudo pip3 install virtualenv and verifying it gives the following output:

$ pip3 show virtualenv
Name: virtualenv
Version: 15.1.0
Summary: Virtual Python Environment builder
Home-page:
Author: Ian Bicking
Author-email:
License: MIT
Location: /usr/lib/python3/dist-packages
Requires: 

However, when I try to create a virtual environment, I get one of these...

Command 'virtualenv' not found, but can be installed with:

sudo apt install virtualenv

Why is that?

1

1 Answer

For it to be run when you install it with pip, it does not put it into your path. You must use the following command to put a symlink to it in into /usr/local/bin

ln -s /usr/lib/python3/dist-packages/virtualenv.py /usr/local/bin/virtualenv

However this is not necessary as you can just install it from the repositories instead of using PyPi by

sudo pip3 uninstall virtualenv && sudo apt-get install python3-virtualenv
6

You Might Also Like