python - pip error: Bad interpreter when trying to run 'pip install ...' on OS X -
i trying install fresh version of virtualenv (there problem path python has stored in sys.executable) , turns out there problem seems related.
when try run pip install virtualenv
, 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 original point in reinstalling virtualenv keep getting error when 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 open(src, 'rb') fsrc: filenotfounderror: [errno 2] no such file or directory: '/usr/local/opt/python3/bin/python3.4'
as sidenote may relevant, rather using default installed python3, brew-installed python3 brewed openssl (an application required it) , placed path of brewed python3 @ top of /etc/paths
.
i have tried install , uninstall python multiple times without success , @ loss of problem be. direction appreciated.
edit after @cel 's suggestions, turned out head of pip file (located @ /usr/local/cellar/python/2.7.10_2/bin/pip
) set hardcode python version #!/usr/local/opt/python3/bin/python3.4
. changed output of which python
/usr/local/cellar/python/2.7.10_2/bin/python
this allowed me succesfully create virtualenv once again. thanks!
i came across similar problem when used homebrew upgrade python version 3.5.2 version 3.6.0. homebrew updated symlink /usr/local/bin/pip3
/usr/local/cellar/python3/3.6.0/bin/pip3
/usr/local/bin/pip
still using old script , pointing python interpreter @ /usr/local/opt/python3/bin/python3.5
.
my course of action follows:
unlinked
/usr/local/bin/pip
, updated point/usr/local/cellar/python3/3.6.0/bin/pip3
.created new symlink
/usr/local/bin/pip3.5
pointed/usr/local/cellar/python3/3.5.2/bin/pip3
, updated header of pip3.5 script point python interpreter @/usr/local/cellar/python3/3.5.2/bin/python3.5
followed same procedure
virtualenv
.
p.s. didn't face problem virtualenv
since using -p
option.
Comments
Post a Comment