virtualenv: uninstall and reinstall on macos

Viewed 5112

I don't remember how I originally installed virtualenv, and apparently none of pip, pip3, and brew are claiming it.

$XXX list | grep virtualenv

Returns nothing. XXX is pip, pip3, and brew.

But here it does return a directory:

$which -a virtualenv
/usr/local/bin/virtualenv

So who is 'controlling' virtualenv? How can I uninstall it and reinstall it?

My motivation for this is because virtualenv is pointing to a non-existing / falsely linked interpreter, and I was advised that reinstallation of virtualenv might mend this problem. Thanks in advance!

$ virtualenv my_venv
-bash: /usr/local/bin/virtualenv: /usr/local/opt/python3/bin/python3.6: bad interpreter: No such file or directory
1 Answers

You might have installed virtualenv with easy_install or downloading the tar.gz file as suggested here https://virtualenv.pypa.io/en/latest/installation/.

Either way, you can try to reinstall virtualenv on top of the current installation with pip. If that doesn't work you might need to fix the problem at the root by fixing the bad interpreter error by installing python again with brew.

virtualenv seems to be a binary at that location so you might as well remove that file from that location /usr/local/bin/ if you have root privileges to do so.

Related