How to force cygwin to run windows python executeable and not the one in its own bin directory

When I execute keyword python in cygwin, it runs the python that exists inside its own internal directory. I cannot remove this python since it is required for some other packages that were downloaded into cygwin and was thus installed automatically.

Please see this: eeng ~

$ where python
C:\cygwin64\bin\python
C:\Users\eeng1\AppData\Local\Programs\Python\Python39\python.exe
C:\Users\eeng1\AppData\Local\Microsoft\WindowsApps\python.exe

eeng ~
$ which python
/usr/bin/python

I want that cygwin uses the second directory for Python executeable rather than the first one. What do I do now? Please note that the /usr/bin/python is not found in windows $PATH. So this problem cannot be fixed from that way.


Solution 1:

I added this line into the .bashrc:

PATH=/cygdrive/c/Users/myusername/AppData/Local/Programs/Python/Python39/:$PATH

Now running which python does not give the python stored inside the cygwin /usr/bin/ but gives the one one in the windows path.

Problem solved.