Command Python2 not found

15,141

Solution 1

Under windows you have to use:

py -2 yourfilename  // for python2.x
py -3 yourfilename  // for python3.x

Solution 2

If you really have installed python2.x and it is on your path, you can ensure that you are installing for python2 by running

pip2 install somepackage

Equivalently you can run

pip3 install somepackage

to ensure that it is installed on python3.x.

This can become a bit messy/tedious in the long run, so it might be worth looking into using virtual environments, or something like miniconda which tend to handle this quite well.

Share:
15,141
kame
Author by

kame

I live in the area between Basel and Zürich. Nice to meet you. :)

Updated on June 04, 2022

Comments

  • kame
    kame almost 2 years

    I have to use Python2 for the following command: python2 -m pip install SomePackage in the command line. I get the message that Python2is not found, but I have definitly installed Python 2.7.1.

    When I run python --version I get the output Python 3.5.1.

    Edit: I use Windows. And the commands whereis and env were also not found.