MSYS2 python command not found, how to fix it on Windows


After installing Python on my fresh MSYS2 I received an error while trying to run it from the console. The bash shell prompted the following output.


bash: python: command not found


Although the Python tool has been successfully installed, the problem is that the builtin shell is unable to locate it.



As you can see from the above screenshot, the Python executable is under the C:\msys64\mingw64\bin directory.

The solution to this problem is to create an alias for Python inside the .bashrc file. Locate the .bashrc file, open it in editing mode with your favorite text editor.





Then add the following lines at the bottom, and save it.

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

Restart the MSYS2. Now you should be able to run python from the console. The following screenshots show python and pip being being executed directly from the console.




© 2020 Copyright by orthodoxpirate.blogspot.com
All Rights Reserved 

No comments

Powered by Blogger.