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

2

7

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

Jaconet answered 15/4, 2018 at 1:9 Comment(0)
J
3
  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

Jaconet answered 15/4, 2018 at 1:43 Comment(0)
P
1

It's probably easier to use pyenv to manage Python versions, and then use python3 -m pip install -U yt-dlp to install yt-dlp into ~/.pyenv/versions/`cat ~/.pyenv/version`/bin.

Permalloy answered 7/4, 2023 at 8:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.