Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

virtualenv error bad interpreter: No such file or directory

If I attempt to create a virtual env I get this error message, which I do not understand: bad interpreter: No such file or directory. I have reviewed this stack overflow answer and have tried to apply it in the diagnostic steps below.

This is my first day running on Mojave but I don't know if that is a factor in this issue or not.

I have created a new empty folder for the project at /Users/Wes/Dropbox/Programming/Python/glade_againn

My plan has been to run the project in the virtualenv /Users/Wes/.virtualenvs/glade_againn

However, when I attempt to use virtualenv I get this error message.

$ virtualenv --version -bash: /usr/local/bin/virtualenv: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory 

If I attempt to install virtualenv with PIP I am told it already exists.

$ pip install virtualenv Requirement already satisfied: virtualenv in /usr/local/lib/python2.7/site-packages (15.2.0) $  

My current PATH is

echo $PATH /Library/Frameworks/Python.framework/Versions/3.6/bin:/opt/local/bin:/opt/local/sbin:/usr/local/opt/[email protected]/bin:/usr/local/Cellar/postgresql/9.5.4_1/bin/psql/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/git/bin:/Users/Wes/bin:/sw/bin:/usr/local/bin:/Users/Wes/.sdkman/candidates/groovy/current/bin/ 

If you search for pyth* across all those directories you get this list, in this order.

/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 /Library/Frameworks/Python.framework/Versions/3.6/bin/python3-config /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6-config /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6m /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6m-config /opt/local/bin/python2.7 /opt/local/bin/python2.7-config /opt/local/bin/python3.4 /opt/local/bin/python3.4-config /opt/local/bin/python3.4m /opt/local/bin/python3.4m-config /opt/local/bin/pythonw2.7 /usr/local/bin/python-32 /usr/local/bin/python2-32 /usr/local/bin/python2.7-32 /usr/local/bin/python3 /usr/local/bin/python3-config /usr/local/bin/python3.6 /usr/local/bin/python3.6-config /usr/local/bin/python3.6m /usr/local/bin/python3.6m-config /usr/local/bin/pythoni /usr/local/bin/pythoni1 /usr/local/bin/pythonw-32 /usr/local/bin/pythonw2-32 /usr/local/bin/pythonw2.7-32 /usr/bin/python /usr/bin/python-config /usr/bin/python2.7 /usr/bin/python2.7-config /usr/bin/pythonw /usr/bin/pythonw2.7 /sw/bin/python2.7 /sw/bin/python2.7-config /usr/local/bin/python-32 /usr/local/bin/python2-32 /usr/local/bin/python2.7-32 /usr/local/bin/python3 /usr/local/bin/python3-config /usr/local/bin/python3.6 /usr/local/bin/python3.6-config /usr/local/bin/python3.6m /usr/local/bin/python3.6m-config /usr/local/bin/pythoni /usr/local/bin/pythoni1 /usr/local/bin/pythonw-32 /usr/local/bin/pythonw2-32 /usr/local/bin/pythonw2.7-32 

Does anyone have a suggestion on how to get virtualenv to work again?

like image 670
WesR Avatar asked Dec 20 '18 06:12

WesR


People also ask

Where is Virtualenv installed?

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.


1 Answers

Try to reinstall using this

pip install -U --force-reinstall virtualenv 

if above solution doesn't work for you you should create a new virtualenv again because of mojave update

like image 162
nishant Avatar answered Oct 14 '22 04:10

nishant