Nowadays, many open source enthusiasts consider youtube-dl to be one of the essential software in their machines. Not only being a tool for downloading videos from various services, youtube-dl can also cut, convert clips or populate files with metadata information when use in conjunction with other tools.
On a few computers that run Linux, sometimes you will encounter errors during youtube-dl installation.
One of the common error messages on new Ubuntu/Debian versions is “/usr/bin/env: ‘python’: No such file or directory”.
This error usually means that your system cannot provide Python support for youtube-dl.
In this article, we will present a few ways to fix this problem in Ubuntu/Debian.
1.Reinstall youtube-dl from snap
Snap (or snappy) is a new, preferred way to install applications on Ubuntu systems. One of its advantages is all software dependencies and libraries are bundled in one isolated package.
This way, your system can run two applications which depend on two different versions of the same library without producing any error.
While still having a few downsides, you can definitely leverage snap to install a youtube-dl version which runs flawlessly out-of-the-box without uninstalling the old youtube-dl binary you’ve just downloaded.
Simply open up Terminal emulator and enter this command :
sudo snap install youtube-dl
Code language: Bash (bash)
Once the process is done, you can verify that youtube-dl is now installed by running the following command :
youtube-dl --v
Code language: Bash (bash)
2. Set python command to point to built-in Python 3
Since Ubuntu 20.04 LTS, the developers dropped support for Python 2 and go all in with Python 3. Therefore, the python shorthand command is not set. Programs which use the built-in Python 2 will show you the following error :
To solve this, you can simply point python
command to Ubuntu built-in Python 3.
Open up a Terminal and type in the following command to do so :
sudo ln -s /usr/bin/python3 /usr/bin/python
Code language: Bash (bash)
After that, you can install youtube-dl by following its official documentation :
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
Code language: Bash (bash)
Please note that if you install other programs that rely on the older version of Python, they may not run or work correctly until you remove the symlink and install the older version of Python, or change the program source code to use Python 3. But the older Python version is no longer supported anyway, so it would be better to use only Python 3 programs in the first place.
“Since Ubuntu 20.04 LTS, the developers dropped support for Python 2 and go all in with Python 3. Therefore, the python shorthand command is not set. ”
I would never have known this when I was trying to install Youtube-dl. No one on the websites showing how to install it have mentioned it. Thank you, thank you, thank you. If it wasn’t for people with the Linux expertise like yourself, I would be still using Windows!
Thank you a lot! It solves the problem for me
Thanks. The command with the link solved it for me.
Thanks for your help. I finally could install youtube-dl in linux Mint 20.3.