Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bad interpreter error when setting up virtualenv for python

Tags:

python

bash

macos

I'm attempting to set up a virtual env, but when I attempt to activate it, I get the following error:

 virtualenv hello
-bash: /usr/local/bin/virtualenv: /usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/Resour: bad interpreter: No such file or directory

Any thoughts on what might be going wrong? My $PATH is as follows:

Users/me/workspace/google-cloud-sdk/bin:/usr/local/bin:/Users/me/workspace/google-cloud-sdk/bin:/urs/local/bin:/Users/me/workspace/google-cloud-sdk/bin:/urs/local/bin:/Users/me/workspace/google-cloud-sdk/bin:usr/local/python:usr/bin/python:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/texbin: No such file or directory

-- the fact that it is returning an error makes me suspect that I've set up my .bash_profile wrong somehow. These are the only modifications I have made:

#Set architecture flags
export ARCHFLAGS="-arch x86_64"

#Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:$PATH

#Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc

# The next line updates PATH for the Google Cloud SDK.
source '/Users/me/workspace/google-cloud-sdk/path.bash.inc'

# The next line enables bash completion for gcloud.
source '/Users/me/workspace/google-cloud-sdk/completion.bash.inc' 

And this is my .bashrc:

# pip should only run if there is a virtualenv currently activated
export PIP_REQUIRE_VIRTUALENV=true
# cache pip-installed packages to avoid re-downloading
export PIP_DOWNLOAD_CACHE=$HOME/.pip/cache
like image 539
orange1 Avatar asked May 27 '15 23:05

orange1


1 Answers

I would suggest you to go with virtualenv wrapper -

export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
export VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
source /usr/local/bin/virtualenvwrapper_lazy.sh

http://virtualenvwrapper.readthedocs.org/en/latest/install.html#quick-start

like image 67
deeshank Avatar answered Oct 28 '22 09:10

deeshank