This has been driving me crazy for the past 2 days. I installed virtualenv on my Macbook using pip install virtualenv
. But when I try to create a new virtualenv using virtualenv venv
, I get the error saying "virtualenv : command not found".
I used pip show virtualenv
and the location of the installation is "Location: /usr/local/lib/python2.7/site-packages" but I can't figure out where the executable is. I tried dozens other similar looking posts but those solutions do not work for me.
Any ideas what might be going wrong here?
To Solve 'virtualenv' is not recognized as an internal or external command, operable program or batch file Error You just need to reinstall virtualenv.
Just put a file with a . pth extension (any basename works) in your virtualenv's site-packages folder, e.g. lib\python2. 7\site-packages , with the absolute path to the directory containing your package as its only contents.
If you try to run virtualenv and find it isn't present, you can install it using pip. virtualenv.exe will likely now be found in your python installation directory under the Scripts subdirectory.
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.
The only workable approach I could figure out (with help from @Gator_Python was to do python -m virtualenv venv
. This creates the virtual environment and works as expected.
I have custom python installed and maybe that's why the default approach doesn't work for me.
On macOS Mojave
First check python is in the path.python --version
Second check pip is installed.pip --version
If it is not installed.brew install pip
Third install virtualenvsudo -H pip install virtualenv
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