Fix Conda Bad Interpreter: No such file or directory Error – Python Tutorial

By | April 19, 2023

When we are running conda command, we may get this error: Bad Interpreter: No such file or directory. In this tutorial, we will introduce you how to fix.

For example, if we have installed Anaconda3 in our linux system.

We have run conda command as follows:

./conda env list

We may get this error:

Fix Conda Bad Interpreter No such file or directory Error Step 1

How to fix this error?

Step 1: view conda file in anaconda3/bin/conda

For example:

cat conda

We may see:

Fix Conda Bad Interpreter No such file or directory Error Step 2

We can find the first line is our error.

Step 2: edit conda file and update the absolute python file in the first line

For example:

vi conda

The modified file is:

Fix Conda Bad Interpreter No such file or directory Error Step 3

Moreover, if you find some error also exist, you may have to modify activate, deactivate file etc al.

Finally, we can run command below to fix this error:

./conda init bash

We may find a .bashrc file in /root/.bashrc and add it to linux environment path

source /root/.bashrc

Then we can find this error is fixed:

Fix Conda Bad Interpreter No such file or directory Error