Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python3.8 on Ubuntu 14.04

I am trying to install Python3.8 on Ubuntu 14.04, I get this error:

E: Unable to locate package python3.8 E: Couldn't find any package by regex 'python3.8'

Is it even possible to have python3.8 on Ubuntu that is that old? If it is possible, please tell me how.

EDIT

When installing from source ( I followed that instruction) I get this error:

Fatal Python error: _PySys_InitCore: can't initialize sys module Python runtime state: preinitialized

Current thread 0x00002ab78e1b3740 (most recent call first): generate-posix-vars failed make: *** [pybuilddir.txt] Error 1

like image 892
aga Avatar asked Sep 17 '25 15:09

aga


2 Answers

An alternative solution could be to compile python statically on a newer system. Then such binaries can be transferred to the target system.

Compilation tested on vanilla Ubuntu 20.04 LTS

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
$ sudo apt-get install build-essential checkinstall
$ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
$ wget https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tgz
$ tar xzf Python-3.8.6.tgz
$ cd Python-3.8.6
$ ./configure LDFLAGS="-static" --disable-shared
$ make LDFLAGS="-static" LINKFORSHARED=" "
....
$ cd ..
$ zip -r Python-3.8.6.zip Python-3.8.6

Transfer Python-3.8.6.zip to target sysytem

$ unzip Python-3.8.6.zip
$ cd Python-3.8.6
$ ./python

Of course you would have to do

make install

or clean this folder, that's your choice.

like image 106
Artur Augustyniak Avatar answered Sep 19 '25 08:09

Artur Augustyniak


Normally, as long as you are not using any kind of dockerization/paravirtualization, simple:

sudo snap install python38

should work.

like image 30
aga Avatar answered Sep 19 '25 08:09

aga