Installieren von Versionen vor Python 3.9 am 21.04

Installieren von Versionen vor Python 3.9 am 21.04

Ich habe auf Ubuntu 21.04 aktualisiert, da ich die LTS-Versionen nicht verwenden möchte (d. h. neuere Pakete habe). Ich habe glücklich an einer neuen Codebasis mit dem Standard-Python 3.9 gearbeitet

Aber für ein älteres Projekt, das auf Python 3.6 läuft, möchte ich auch eine Version vor 3.9 installieren (ich habe ein Verpackungsproblem im Zusammenhang mit einem Problem mit Version 3.9 festgestellthttps://github.com/hzdg/django-enumfields/commit/8a54ab6ca1a406b4f736b1d8a1daff49431a1c5cAber ich hätte lieber 3.6 oder 3.7 nach Bedarf für meine virtuellen Umgebungen zur Verfügung, als einen 3.9-spezifischen Fix für eine Codebasis einzubauen, die derzeit auf 3.6 läuft).

Ich habe das Deadsnakes-PPA installiert sudo add-apt-repository ppa:deadsnakes/ppaund ein Update durchgeführt. Aber dann bekomme ich beim Versuch, eine frühere Python-Version zu installieren, ein Abhängigkeitsproblem (vermutlich, weil es sich um ein Focal-Paket handelt).

sudo apt-get install python3.7
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.7 : Depends: libpython3.7-stdlib (= 3.7.12-1+focal1) but it is not installable
E: Unable to correct problems, you have held broken packages.

Antwort1

Sie sollten es selbst kompilieren. Verwenden Sie:

sudo apt-get install libssl-dev openssl
wget https://www.python.org/ftp/python/<version>/Python-<version>.tgz
tar xzvf Python-<version>.tgz
cd Python-<version>
./configure
make

während <version>eine gültige Python-Version ist, z. B. 3.7.0.

verwandte Informationen