Doubt : Command Line - 6. The PATH Variable

Screen Link:

Typing python and /usr/bin/python in command line are yielding slightly different results. They are pointing to two different versions of Python. Why is this so?

1 Like

The VM that DataQuest uses is a Linux Distribution, by default Linux comes with python 2 preinstalled.
You can have multiple versions of python in the same OS. You can also specify the default version you want to use which in this case is python3.

To find your python binary run

$ which python

This would return /usr/bin/python

And in DataQuest, maybe they alias python to python 3

alias python=/usr/local/bin/python3

so when you run python on the terminal it will always bring python version3…

That helps??

Yes, this can be verified by running alias | grep python and inspecting the output.

In addition to what Victor said, it would probably be helpful for you to review Knowing What You’re Running.

1 Like


Hey thanks for the response. If as per what you said DQ is using alias then,

$ which python

should return /usr/bin/python3 right? Or did I understand it wrong?

Hey @Bruno, I tried the above comment and I got the output as shown below. I quite did not understand what it means. Could you please enlighten me?


It’s using the alias $DQ_VENV/python. If you run echo $DQ_VENV, you’ll see it expand to a path.

Piecing all this together, will give you the path to the file that the alias python represents.

alias | grep python                                                             

alias ipython='$DQ_VENV/ipython'                                                

alias python='$DQ_VENV/python'                                                  

/home/dq$ echo $DQ_VENV                                                         


No, i Explained here.