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


In Ubuntu 20.04, we get the following error:

❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:        20.04
Codename:       focal

❯ youtube-dl https://www.youtube.com/watch?v=b4mihzeFqGA
/usr/bin/env: ‘python’: No such file or directory

How can I fix it?

Best Answer

In Ubuntu 20.04, python3 is the installed default. The python variable is not set:

❯ which python
python not found

We can get around this by using python3 and which:

❯ python3 $(which youtube-dl) https://www.youtube.com/watch?v=0IE-CXNs6Sw
[youtube] 0IE-CXNs6Sw: Downloading webpage
Related Question