• Home
  • Releases
  • Submit Vuln
  • Press
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
    • VDP
  • Tutorials
    • All Posts
    • Photoshop on Linux
    • macOS on Linux
  • Supporters
  • Projects
  • Training
Sick Codes - Security Research, Hardware & Software Hacking, Consulting, Linux, IoT, Cloud, Embedded, Arch, Tweaks & Tips!
  • Home
  • Releases
  • Submit Vuln
  • Press
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
    • VDP
  • Tutorials
    • All Posts
    • Photoshop on Linux
    • macOS on Linux
  • Supporters
  • Projects
  • Training
No Result
View All Result
Sick Codes - Security Research, Hardware & Software Hacking, Consulting, Linux, IoT, Cloud, Embedded, Arch, Tweaks & Tips!
  • Home
  • Releases
  • Submit Vuln
  • Press
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
    • VDP
  • Tutorials
    • All Posts
    • Photoshop on Linux
    • macOS on Linux
  • Supporters
  • Projects
  • Training
No Result
View All Result
Sick Codes - Security Research, Hardware & Software Hacking, Consulting, Linux, IoT, Cloud, Embedded, Arch, Tweaks & Tips!
No Result
View All Result
Home Tutorials

How To Install Latest Python In Ubutnu 18.04 (Shell Commands & Docker/Dockerfile)

by Sick Codes
July 18, 2020
in Tutorials
0

This simple copy paste tutorial will allow you to install any version of Python.
Install python 2, all the way up to python 3.9+

You can select any version from this list: https://www.python.org/ftp/python/

I highly recommend using pipenv instead of installing python locally on any OS:
Works on ANY Ubuntu 16, 17, 18, 19, 20+

Using pipenv (highly, highly recommended!)

sudo apt update -y
sudo apt install python pipenv git -y
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"

Now you can install any version of Python with pyenv and pipenv

pyenv install 3.9-dev
cd /home/my/project
pipenv --python 3.9
pipenv shell
# pipenv run pip install -r requirements.txt
# pipenv run python manage.py

Force Installing on Ubuntu

# choose your version
py_version=3.8.4
sudo apt update -y
sudo apt install build-essential gcc autoconf make automake \
    wget libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev \
    libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev libffi-dev uuid-dev -y
wget https://www.python.org/ftp/python/${py_version}/Python-${py_version}.tgz
tar xzf Python-${py_version}.tgz
cd Python-${py_version}
sudo ./configure --enable-optimizations
sudo make altinstall
export PATH=/opt/python-${py_version}/bin:$PATH
which python3.8
python3.8 --version

Looking for the CentOS version? See CentOS version.

Install Python 3.x in a Dockerfile

# choose your version
ENV py_version=3.8.4
WORKDIR /root/
RUN apt update -y 
RUN apt install build-essential gcc autoconf make automake \
    wget libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev \
    libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev libffi-dev uuid-dev -y
RUN wget https://www.python.org/ftp/python/${py_version}/Python-${py_version}.tgz
RUN tar xzf Python-${py_version}.tgz
WORKDIR Python-${py_version}
RUN ./configure --enable-optimizations
RUN make altinstall
RUN export PATH=/opt/python-${py_version}/bin:$PATH
RUN which python3.8
RUN python3.8 --version
Next Post

CVE-2020-15590 - Private Internet Access VPN for Linux – Exposure of Sensitive Information to an Unauthorized Actor

How to install the silver searcher (ag) on ARM devices such as Raspberry Pi and Odroid

How to Install ag Silver Searcher (silversearcher-ag) on ARM Devices [Raspberry Pi, Odroid]

Docker-iOS

Docker-eyeOS - Debug the iPhone's XNU Kernel on GNU/Linux!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result
  • Home
  • Releases
  • Submit Vuln
  • Press
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
    • VDP
  • Tutorials
    • All Posts
    • Photoshop on Linux
    • macOS on Linux
  • Supporters
  • Projects
  • Training

© 2017-2021 Sick.Codes

@sickcodes

@sickcodes

@sickcodes

Discord Server

sickcodes.slack.com

t.me/sickcodeschat

./contact_form