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

会有一股神秘感。 提交于 2019-12-06 03:48:17

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/48524196/how-to-get-python-to-run-python-3-in-wsl-bash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!