Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zsh: /usr/local/bin/youtube-dl: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory

macOS 10.12

Seems like the same problem here but top answers just led to more questions.

Top answer says to do:

brew link --overwrite python

which yields:

Warning: Already linked: /usr/local/Cellar/python/3.6.5
To relink: brew unlink python && brew link python

I'm pretty sure I need to get homebrew to switch to 2.7 rather than using version 3. I do

brew unlink python && brew link python

and get:

Unlinking /usr/local/Cellar/python/3.6.5... 25 symlinks removed
Linking /usr/local/Cellar/python/3.6.5... 25 symlinks created

Is there a way I can tell it to link to a specific version? /usr/local/Cellar/python/ contains: 2.7.13 2.7.14 2.7.14_3 3.6.3 3.6.5

How can I get my system to always use 2.7.14_3?

/usr/local/opt/python/bin contains python3, python3-config, and 3.6 versions. How can I get 2.7 in here and remove 3 and 3.6?

Also which python returns /usr/bin/python. When I type python -V I get Python 2.7.10. /usr/bin contains python2.7, python2.7-config as well as some other seemingly-python-related things (but no python3, which is good I think). Is this different from homebrew pythons? Thanks in advance.

Edit:

Second-to-top answer says to do head -n1 /usr/local/bin/pip which returns

head: /usr/local/bin/pip: No such file or directory

and

mv /usr/local/bin/pip /usr/local/bin/pip.old

returns

mv: rename /usr/local/bin/pip to /usr/local/bin/pip.old: No such file or directory

like image 429
A__ Avatar asked Apr 15 '18 01:04

A__


1 Answers

  1. brew uninstall --ignore-dependencies python (you might not want to --ignore dependencies depending on what other things you might be breaking, i.e. numpy, opencv)

  2. brew install python@2 see here

  3. brew uninstall youtube-dl

  4. brew install youtube-dl

like image 165
A__ Avatar answered Sep 26 '22 15:09

A__