I did several wrong things for my first day on Ubuntu when trying to code with Python, so I just reinstalled it. Can anyone tell me the best way to install Python here? I am using Ubuntu 20.04, and I am updating to Ubuntu 23.10 right now.
I see sudo apt install python3
? OK, but it was why my Ubuntu was corrupted. Can anyone tell me how to get complete python installed without breaking any programs - with python pip, venv, and whatever else is needed.
Someone asked why do I need latest the python version. I just prefer it, but I want any Python 3 (I prefer to use 3.9 and new always).
I did not install any Python. The only thing I did was sudo apt install python3-pip
and also python3-venv (and python3.11-venv), venvs failed to install but why does VSCode show 4 different Python interpreters now? I didn't install any python version. I installed Ubuntu 20.04 from an ISO file, and upgraded to 23.10. The default Python package on Ubuntu 23.10 is python3.12.
Image of VSCode showing Python interpreters:
ashish@ashish-pc:~$ pip3 --version
pip 23.1.2 from /usr/lib/python3/dist-packages/pip (python 3.11)
ashish@ashish-pc:~$ pip3 --version
pip 23.1.2 from /usr/lib/python3/dist-packages/pip (python 3.11)
ashish@ashish-pc:~$ sudo apt-get update && sudo apt-get install python3-venv
Hit:1 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu mantic InRelease
Hit:2 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu mantic-updates InRelease
Hit:3 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu mantic-backports InRelease
Hit:4 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu mantic-security InRelease
Hit:5 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:6 https://packages.microsoft.com/repos/code stable InRelease
Hit:7 http://archive.ubuntu.com/ubuntu mantic InRelease
Hit:8 http://archive.ubuntu.com/ubuntu mantic-updates InRelease
Hit:9 http://security.ubuntu.com/ubuntu mantic-security InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python3-venv : Depends: python3.11-venv (>= 3.11.2-1~) but it is not going to be installed
Depends: python3 (= 3.11.2-1) but 3.11.4-5 is to be installed
E: Unable to correct problems, you have held broken packages.
ashish@ashish-pc:~$ ^C
ashish@ashish-pc:~$
I used sudo apt install python3-pip
it worked and I got pip. Now when I tried sudo apt install python3-venv
it generated an error message. I just noticed that the python -m venv
command exists.
sudo apt install python3
. This system should NEVER be replaced with another Python release, as this may break your system up to being not usable anymore. However, multiple Python version can be installed in parallel without conflicting by compiling other version yourself and making sure to not replace the system's version while installing. – noisefloor Mar 16 '24 at 08:00sudo apt install python3-pip
. Do I uninstall it now before executing next command because I do not want to corrupt it again.Also, you meant to do that command? (3.11 is installed by default on my Ubuntu 23.10) To install python? Ok, but it would install pip+venv or no? I need those with my Python
– user16280919 Mar 16 '24 at 08:41