1

I am trying to create a new virtual environment for a tutorial. I have installed virtualenv and virtualenvwrapper multiple times but every time I try creating a new virtual environment my terminal displays - mkvirtualenv: command not found. When I try finding out the version of virtualenv it shows virtualenv: command not found. Something similar was happening with my pip installation as well but then it got resolved when I used some command.

I would like to point out that my PATH seems to be really messed up. The PATH is pointing to /Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin. Please help.

I saw something else when I use pip show virtualenv it gives me details of the version and the author but when I use virtualenv --version it sends a virtualenv: command not found.

3
  • pip install virtualenv
    – Denis Tsoi
    Commented May 15, 2020 at 13:44
  • It’s most likely that it’s not installed in your python path
    – Denis Tsoi
    Commented May 15, 2020 at 13:44
  • @DenisTsoi so this worked for me - python -m virtualenv venv.
    – Arif
    Commented May 15, 2020 at 14:23

2 Answers 2

3

First of all, you will need to install virtualenv as it is a python 2 external dependency.

pip install virtualenv

this will allow you to use virtualenv globally.

Alternatively, you can use from Python 3.5+

python -m virtualenv venv

However if you dont wish to support python 2 you can use venv which is installed on from python 3.3

python3 -v venv venv
2

Took quite some time to figure it out but what worked for me was to install it using pip3 install instead of pip install

pip3 install virtualenv 

Not the answer you're looking for? Browse other questions tagged or ask your own question.