This tutorial intends to show you how to Fix virtualenvwrapper workon mkvirtualenv command not found Linux. First, let’s discuss why you may be getting this error. To answer this question, we can say that this usually happens because your shell doesn’t recognize where to access the virtualenvwrapper. So the virtualenvwrapper may not be installed correctly or configured. Now you can follow the steps below to see how you can fix this error.
Steps To Fix virtualenvwrapper workon mkvirtualenv command not found Linux
At this point, you can fix this issue by editing your shell’s startup file and adding the correct path of the packages to the file. To do this, follow the steps below.
Step 1 – Find Python Interpreter and virtualenvwrapper.sh Script Path
First, you must find your Python and virtualenvwrapper.sh Script path on your Linux server. To do this, run the commands below:
To find your script path, run the command below:
find / -name virtualenvwrapper.sh 2>/dev/null
Step 2 – Fix the mkvirtualenv command not found on Linux
At this point, you can edit the shell’s startup file with your favorite text editor. Here my shell is bash and I open the file with the vi editor:
At the end of the file, add the following lines:
export WORKON_HOME=$HOME/.virtualenvs export VIRTUALENVWRAPPER_PYTHON=your_python_interpreter_path source your_virtualenvwrapper.sh_path
Remember to replace your_python_interpreter_path and your_virtualenvwrapper.sh_path with the ones you have found in the above step.
In my case it is as follows:
export WORKON_HOME=$HOME/.virtualenvs export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 source /home/edxd/.local/bin/virtualenvwrapper.sh
When you are done, save and close the file.
To apply the changes, reload the bashrc file:
That’s it you are done. Now you can use both the workon, mkvirtualenv, and all other virtualenvwrapper commands in your command line in Linux.
As we described, this error happens because the shell doesn’t recognize the correct path of the virtualenvwrapper. So we show you how you can fix this error by editing the shell’s startup file and adding your virtualenvwrapper and Python to the file. This can help you to easily fix this error. Hope you enjoy it.
Also, you may be interested in these articles: