0

Youtube-dl is months out of date in the repos so I installed it using this method

(though I changed the location to usr/bin/youtube-dl as that's what which youtube-dl showed)

but then I get

$ youtube-dl
/usr/bin/env: ‘python’: No such file or directory

$ python2 youtube-dl
python2: can't open file 'youtube-dl': [Errno 2] No such file or directory

But it works if I enter

$ python2 /usr/bin/youtube-dl 
Usage: youtube-dl [OPTIONS] URL [URL...]

$ python3 /usr/bin/youtube-dl 
Usage: youtube-dl [OPTIONS] URL [URL...]

I'm using Xubuntu 20.04, could someone tell me how to fix this?

0

Starting with 20.04 /usr/bin/python is no longer there. And youtube-dl starts with:

#!/usr/bin/env python

So what you can do is create the symbolic link yourself:

sudo ln -s /usr/bin/python3 /usr/bin/python

And then it should work:

$ youtube-dl
| improve this answer | |
  • Thanks but that doesn't seem to work: $ sudo apt-get install python-minimal gives "the following packages replace it: python2-minimal:i386 python2-minimal" and sudo apt-get install python2/python3-minimal both give "is already the newest version" – Johnny5ive Jun 13 at 21:51
  • 1
    You're right. Beginning with 20.04, that no longer works. I updated the answer. – Eduardo Trápani Jun 13 at 22:23
  • Thanks, sorry about the delayed response. I came across another similar topic and I used the suggestion there which fixed it: sudo sed -i '1s/python/python3/' /usr/bin/youtube-dl – Johnny5ive Jun 20 at 13:11
  • 1
    That works too, but you will have to do it after each upgrade of youtube-dl, because you are patching the program. The symlink in the answer is something you will do only once. – Eduardo Trápani Jun 20 at 14:13
  • Ah I see, I wasnt aware, thanks for pointing that out – Johnny5ive Jun 20 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.