Software & AppsOperating SystemLinux

How To Fix “Bad Interpreter” Error When Running pip3 on Ubuntu 20.04 WSL

Ubuntu 19

When working with Ubuntu 20.04 on Windows Subsystem for Linux (WSL), you might encounter an error message saying “bad interpreter” when trying to run pip3. This can be quite frustrating, especially when you’re trying to install a Python package. In this article, we’ll guide you through the process of resolving this issue.

Understanding the Problem

The “bad interpreter” error typically happens when the system cannot find the Python interpreter specified in the pip3 script. This might occur if the Python version that pip3 is trying to use doesn’t exist, or if the symbolic link (symlink) pointing to the Python interpreter is broken.

Checking the Python Version

First, let’s check the Python version installed on your Ubuntu WSL. Open your terminal and run the following command:

python3 --version

This command will display the version of Python 3 installed on your system. If the version is correct, you can proceed to the next step. If not, you might need to install or update your Python version.

Creating a Symlink

A symlink is a file that points to another file or directory. In this case, you can create a symlink from the correct Python version to the expected location. Run the following command:

sudo ln -s /usr/bin/python3.8 /usr/bin/python3.6

Here, ln -s creates a symbolic link. /usr/bin/python3.8 is the source file (the actual location of Python 3.8), and /usr/bin/python3.6 is the target file (the expected location of Python 3.6).

After creating the symlink, try running pip3 install pandas again and see if the “bad interpreter” error is resolved.

Alternative Solution

If the above steps do not work, you can try an alternative solution. First, remove the existing symlink by running:

sudo rm /usr/bin/python3

Then, install the python-is-python3 package:

sudo apt install python-is-python3

This package ensures that the python3 command points to the correct Python version. After installing the package, try running pip3 install pandas again and see if the issue is resolved.


In this article, we’ve discussed how to resolve the “bad interpreter” error when running pip3 on Ubuntu 20.04 WSL. We hope this guide is helpful and allows you to continue your Python development without any hitches. Remember, the key is to ensure that pip3 is pointing to the correct Python interpreter. If you have any questions or need further assistance, feel free to leave a comment below.

What is Windows Subsystem for Linux (WSL)?

Windows Subsystem for Linux (WSL) is a compatibility layer that allows running Linux binaries natively on Windows 10 and Windows Server 2019. It provides a Linux-like environment on Windows, enabling users to run Linux command-line tools and utilities.

How do I uninstall a Python package installed with pip3?

To uninstall a Python package installed with pip3, you can use the following command:

pip3 uninstall package_name

Replace package_name with the name of the package you want to uninstall.

Can I use pip instead of pip3 in Ubuntu 20.04 WSL?

Yes, you can use pip instead of pip3 in Ubuntu 20.04 WSL. By default, pip refers to the Python 2 version, while pip3 refers to the Python 3 version. However, if you have only Python 3 installed, pip will also refer to the Python 3 version, so you can use either pip or pip3 interchangeably.

Leave a Comment

Your email address will not be published. Required fields are marked *