Are you trying to resolve the error 'mkvirtualenv: command not found'?
This guide is for you.
virtualenvwrapper is a set of shell functions defined in Bourne shell compatible syntax. virtualenv is what enables you to create many different Python environments in your Linux / macOS system.
With virtualenvwrapper you can automate tests run under the following shells on a Linux or OS X machine.
In this context, we shall look into the causes of this error and methods to fix it.
More information about mkvirtualenv
mkvirtualenv is a command that is a part of virtualenvwrapper. It is mainly used to create a new virtualenv (virtual environment).
Also, it gets installed as part of virtualenvwrapper.
virtualenvwrapper a set of extension commands for Python virtual environment management.
Moreover, it works in several shell environments for Linux, OSX, and Windows.
These include: bash, zsh, Powershell, and the windows command prompt.
Fixes for the error 'mkvirtualenv: command not found' ?
One of our customers installed virtualenv and virtualenvwrapper, but still received the 'mkvirtualenv: command not found' error message.
Here are the steps to properly install virtualenvwrapper.
1. Define the path virtualenvwrapper in the “.bashrc” so that the shell knows where the virtualenvwrapper.sh bash script resides.
So locate where virtualenvwrapper.sh script is.
By default, the virtualenvwrapper is installed in the path:
2. After running the “pip install virtualenvwrapper” command, first create a directory where all the virtual environments will reside.
Here, we are putting them in “~/.environments”:
3. Now open the “~/.bashrc” or “~/.profile” file and add the following to the end of the file:
4. Finally, we need to inform the bash about the changes we made.
For that, run the following command to re-load the .bashrc configuration OR just simply close the shell and re-open it:
Now, you must be able to run the mkvirtualenv command without any error.