bash 如何让`python`在WSL bash中运行Python 3?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48524196/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get `python` to run Python 3 in WSL bash?
提问by urig
When I type python
into my bash shell (Windows Subsystem for Linux) in Windows 10 Home, I get the following error message:
当我python
在 Windows 10 Home 中输入我的 bash shell(适用于 Linux 的 Windows 子系统)时,我收到以下错误消息:
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.
我试过安装,python3
但被告知它已经安装并且是最新的。
I've tried uninstalling python-minimal
but am told it's not installed (!)
我试过卸载,python-minimal
但被告知它没有安装(!)
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 的“竞争”包?如何解决冲突并配置我的 WSL bash 以运行 Python 3 python
?
回答by Srdjan Grubor
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
在 linux 世界中作为 CLI 命令几乎总是意味着python2
而不是python3
. 确保您已python2
安装 ( sudo apt install python
)。
DO NOTalias python
to python3
- this is some bad advice!
不要别名python
来python3
-这是一些不好的建议!
To run python3
, you have to specify python3
on the CLI.
要运行python3
,您必须python3
在 CLI上指定。