To install virtualenv, just use pip install virtualenv . To create a virtual environment directory with it, type virtualenv /path/to/directory . Activating and deactivating the virtual environment works the same way as it does for virtual environments in Python 3 (see above).
Verify if Virtualenv is installed There is a chance that virtualenv is already installed on your system. If you see a version number (in my case 1.6. 1), it's already installed.
If you installed it with
pip install virtualenv
You need to run
sudo /usr/bin/easy_install virtualenv
which puts it in /usr/local/bin/
.
The above directory by default should be in your PATH
; otherwise, edit your .zshrc
(or .bashrc
) accordingly.
I faced the same issue and this is how I solved it:
~/.local/lib/pythonX.X/site-packages
/usr/lib/pythonX.X/dist-packages
. This path might be different for you.pip uninstall virtualenv
and then reinstall it with sudo pip install virtualenv
(or install as root)The simplest answer. Just:
pip uninstall virtualenv
and then:
pip install virtualenv
Or you maybe installed virtualenv with sudo
, in that case:
pip install --user virtualenv
On Ubuntu 18.04 LTS I also faced same error. Following command worked:
sudo apt-get install python-virtualenv
I had same problem on Mac OS X El Capitan.
When I installed virtualenv
like that sudo pip3 install virtualenv
I didn't have virtualenv
under my command line.
I solved this problem by following those steps:
virtualenv
installation by calling sudo su
virtualenv
by calling pip3 install virtualenv
virtualenv
from both user
and super user
account.I had the same issue. I used the following steps to make it work
sudo pip uninstall virtualenv
sudo -H pip install virtualenv
That is it. It started working.
Usage of sudo -H
----> sudo -H:
set HOME
variable to target user's home dir.
python3 -m virtualenv virtualenv_name
or
python -m virtualenv virtualenv_name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With