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
?
If you're running Ubuntu 20 under WSL, there is a new package called python-is-python3
:
cameron@Nook:/mnt/c/Users/camer$ sudo apt install python-is-python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
python-is-python3
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 2364 B of archives.
After this operation, 10.2 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 python-is-python3 all 3.8.2-4 [2364 B]
Fetched 2364 B in 0s (7208 B/s)
Selecting previously unselected package python-is-python3.
(Reading database ... 33571 files and directories currently installed.)
Preparing to unpack .../python-is-python3_3.8.2-4_all.deb ...
Unpacking python-is-python3 (3.8.2-4) ...
Setting up python-is-python3 (3.8.2-4) ...
cameron@Nook:/mnt/c/Users/camer$ python --version
Python 3.8.10
Alternatively, you could use update-alternatives
:
sudo update-alternatives --install /usr/bin/python python $(readlink -f $(which python3)) 3
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With