Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change python version in windows git bash?

I've installed python 3.5 and python 2.7 on windows. And I've added path for python 2.7 in PATH variable. When I type 'python --version' in windows cmd, it prints 2.7. But when i type 'python --version' in git bush, it prints 3.5. How to change python version in windows git bash to 2.7?

like image 635
Semyon Avatar asked Oct 06 '15 09:10

Semyon


People also ask

How do I switch to Python 3.7 on Windows?

As a standard, it is recommended to use the python3 command or python3. 7 to select a specific version. The py.exe launcher will automatically select the most recent version of Python you've installed. You can also use commands like py -3.7 to select a particular version, or py --list to see which versions can be used.


1 Answers

Follow these steps:

  1. Open Git bash, cd ~
  2. Depending on your favorite editortouch, code or vim (in my case) type code .bashrc
  3. Add the line alias python='winpty c:/Python27/python.exe' to the open .bashrc
  4. Save and Close.
  5. Try python --version on git bash again.

Hopefully it works for you.

like image 183
Job Collins Avatar answered Sep 19 '22 23:09

Job Collins