-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-ubuntu-python.sh
executable file
·44 lines (34 loc) · 1.08 KB
/
update-ubuntu-python.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Ottinger Digital Labs, LLC
#
# Author: Evan Ottinger @OttySec
#
# Description: A script to update Python3 to the latest
# version on Ubuntu. Based off of blog by Rehan Haider:
# https://cloudbytes.dev/snippets/upgrade-python-to-latest-version-on-ubuntu-linux
#
# Not guaranteed, use at your own risk, yadayada.
## Add the deadsnakes ppa branch to the apt repository
add-apt-repository ppa:deadsnakes/ppa
## Update the apt database
apt update
## Install the latest version of Python
apt install python3.10
## Make Python3.10 the default version
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
## Remove the default version of Python
apt remove python3.8
apt autoremove
## Fix pip3
apt install python3.10-distutils
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.10 get-pip.py
rm get-pip.py
## Fix venv
apt install python3.10-venv
## Fix Python3-apt
apt remove --purge python3-apt
apt autoremove
## Fix link to Python3
update-alternatives --config python3