I am trying to install a fresh version of virtualenv (there is some problem with the path that python has stored in sys.executable) and it turns out there is another problem that actually seems related.
When I try to run pip install virtualenv
, I get this output:
-bash: /usr/local/Cellar/python/2.7.10_2/bin/pip: /usr/local/opt/python3/bin/python3.4:
bad interpreter: No such file or directory
Now my original point in reinstalling virtualenv is that I keep getting this error when I run virtualenv venv
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/virtualenv.py", line 2363, in <module>
main()
File "/Library/Python/2.7/site-packages/virtualenv.py", line 832, in main
symlink=options.symlink)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 994, in create_environment
site_packages=site_packages, clear=clear, symlink=symlink))
File "/Library/Python/2.7/site-packages/virtualenv.py", line 1288, in install_python
shutil.copyfile(executable, py_executable)
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/shutil.py", line 108, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/opt/python3/bin/python3.4'
As a sidenote that may be relevant, rather than using the default installed python3, I brew-installed a python3 with a brewed openssl (an application required it) and placed the path of the brewed python3 at the top of my /etc/paths
.
I have tried to install and uninstall python multiple times without any success and am completely at a loss of what the problem could be. Any direction would be greatly appreciated.
EDIT
After @cel 's suggestions, it turned out that the head of my pip file (located at /usr/local/Cellar/python/2.7.10_2/bin/pip
) was set to hardcode a python version as so #!/usr/local/opt/python3/bin/python3.4
. I changed this to the output of which python
which was /usr/local/Cellar/python/2.7.10_2/bin/python
This allowed me to succesfully create a virtualenv once again. Thanks!
echo $PYTHONPATH
print anything?head -1 /usr/local/Cellar/python/2.7.10_2/bin/pip
?python -E -m pip -V
andpython -E -m pip -V
may be interesting.