Search code examples
pythonbashwindows-10windows-subsystem-for-linux

How to get `python` to run Python 3 in WSL bash?


When I type python into my bash shell (Windows Subsystem for Linux) in Windows 10 Home, I get the following error message:

The program 'python' can be found in the following packages:
 * python-minimal
 * python3
Try: sudo apt install <selected package>

I've tried installing python3 but am told it's already installed and up to date.

I've tried uninstalling python-minimal but am told it's not installed (!)

Why am I seeing two "competing" packages for Python? How can I fix the conflict and configure my WSL bash to run Python 3 from python?


Solution

  • python in linux world as a CLI command almost always means python2 and not python3. Make sure that you have python2 installed (sudo apt install python).

    DO NOT alias python to python3 - this is some bad advice!

    To run python3, you have to specify python3 on the CLI.