Reputation: 337
All seems to work just fine for both python 2 and 3:
$ which Python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
$ python --version
Python 2.7.9
$ python2
Python 2.7.9 (v2.7.9:648dcafa7e5f, Dec 10 2014, 10:10:46)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
$ python3
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
My .bash_profile settings are as follows:
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH
The problem:
$ virtualenv My_Env
-bash: /usr/local/bin/virtualenv: /usr/local/opt/python3/bin/python3.4: bad interpreter: No such file or directory
The path above does not exist. I downloaded my python packages directly from the python site and installed using the default settings.
Prior to this, I used Python installed with HomeBrew, but this path does not appear to be a brew file path anyway.
Bottom line... My file path is messed up somewhere other than in my .bash_profile and I have no idea where to look to fix it.
Also note that I set up my other computer with the same exact .bash_profile and python installations and it works perfectly...
Both are running Mac Yosemite.
Thanks in advance!
Upvotes: 16
Views: 22156
Reputation: 133
My problem was as simple as having spaces in the directory at the top of venv/bin/pip
which meant that the path was inside quotes. As soon as I made sure that it wasn't under a directory with spaces and removed the quotes it worked.
eg. #!"/Users/Tomm/MY PROJECT/venv/bin/python"
should be changed to #!/Users/Tomm/MY-PROJECT/venv/bin/python
Upvotes: 7
Reputation: 871
Re-installing virtualenv should solve this. I also went through same bug and reinstalling using pip solved this for me.
Upvotes: 1
Reputation: 1404
You can check the "activate" file in your virtualenv bin folder, and see what is written there at around line 42, and then can actually manually set it, while keeping in mind that all the executables in this bin folder are hard coded for the first shebang line.
You will need to change them as well. Or just move the folder to the right place for you current temporary task, otherwise you might need a virtualenv relocation tool or just re-install it.
Upvotes: 1
Reputation: 337
Ok, I was able to fix the problem with a fresh install of virtualenv. I assume that is where the path issue was located (somewhere in the installation of virtualenv).
Upvotes: 12