Jiaqi-Liu Jiaqi-Liu - 4 months ago 9
Python Question

"which version" output differently with setting version in PyCharm

I am using currently the latest version of PyCharm and python 2.7 (Home brew). I set python version in PyCharm like this:

enter image description here

However, when I run codes in the same project:

enter image description here

I get output like this:

enter image description here

Why is that? And how can I config the right Python?

Thanks!

Answer

You shouldn't be using which python to find out which python you're using. Try this instead:

import sys

print(sys.executable)
Comments