如何在WSL bash中获取`python`来运行Python 3? [英] How to get `python` to run Python 3 in WSL bash?
问题描述
当我在Windows 10 Home中的bash shell(Linux的Windows子系统)中键入 python
时,出现以下错误消息:
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>
我曾经尝试安装 python3
,但被告知它已经安装并且是最新的.
I've tried installing python3
but am told it's already installed and up to date.
我尝试卸载 python-minimal
,但被告知未安装(!)
I've tried uninstalling python-minimal
but am told it's not installed (!)
为什么我看到两个用于Python的竞争"软件包?如何解决冲突并配置WSL bash以从 python
运行Python 3?
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
?
推荐答案
python
在Linux世界中,作为CLI命令,几乎总是表示 python2
,而不是 python3
.确保已安装 python2
( sudo apt install python
).
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
).
请勿将 python
别名为 python3
-这是一些不好的建议!
DO NOT alias python
to python3
- this is some bad advice!
要运行 python3
,必须在CLI上指定 python3
.
To run python3
, you have to specify python3
on the CLI.
这篇关于如何在WSL bash中获取`python`来运行Python 3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!