Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

msys2 shell can't find python even though it exists

If I use 'which' to find python it comes back:

$ which -a python.exe
which: no python.exe in (C:/msys32/mingw32/bin;/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/opt/xtensa-esp32-elf/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)

but if I do a 'dir' of C:/msys32/mingw32/bin python files are found:

$ dir C:/msys32/mingw32/bin/py*
C:/msys32/mingw32/bin/pydoc
C:/msys32/mingw32/bin/python.exe
C:/msys32/mingw32/bin/python2.7.exe
C:/msys32/mingw32/bin/python2.7-config
C:/msys32/mingw32/bin/python2.exe
C:/msys32/mingw32/bin/python2-config
C:/msys32/mingw32/bin/python2w.exe
C:/msys32/mingw32/bin/python-config
C:/msys32/mingw32/bin/python-config.sh
C:/msys32/mingw32/bin/python-config-u.sh

This is under Windows 10. Any ideas please?

like image 539
David Norbury Avatar asked Jun 12 '26 02:06

David Norbury


1 Answers

The problem is that the bash shell can not locate the python executable. To solve the issue a change should be done inside the .bashrc file.

The following configuration should be done inside the .bashrc file.

# python and pip alias
alias python="c:/msys64/mingw64/bin/python3.8.exe"
alias pip="c:/msys64/mingw64/bin/pip3.exe"

More detailed information can be found on this blogpost.

like image 144
orthodoxpirate Avatar answered Jun 14 '26 11:06

orthodoxpirate



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!