Python not recognizing virtualenv

Viewed 86

First I run command pip install virtualenv then after I run python -m virtualenv venv, I get this following error msg

"/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named virtualenv"

Cuurently, I'm using python v2.7.16 and when I run pip freeze | grep virtualenv , I get virtualenv==20.4.2 so virtualenv is there. When I run which python I get /usr/bin/python and I don't have .bash_profile when I run ls -a. I am using mac. What could be the reasons python not recognizing virtualenv when it's there?

1 Answers
  1. You may create .bash_profile and it is auto-recognised by the macintosh machine.

  2. Please also run which pip and make sure the pip is in the same bin as your python (/usr/bin/python)

The bottom line is pip used to install a package by default will install the packages in the bin directory that also stored your python executable.

Related