
私はLTSリリース(つまり、より新しいパッケージ)を使いたくないので、Ubuntu 21.04にアップグレードしました。デフォルトのPython 3.9で新しいコードベースに満足して取り組んでいます。
しかし、Python 3.6で動作する古いプロジェクトでは、3.9より前のバージョンもインストールしたい(バージョン3.9の問題に関するパッケージングの問題が発生しました)https://github.com/hzdg/django-enumfields/commit/8a54ab6ca1a406b4f736b1d8a1daff49431a1c5cしかし、現在 3.6 で実行されているコードベースに 3.9 固有の修正を加えるよりも、必要に応じて仮想環境で 3.6 または 3.7 を利用できるようにしたほうがはるかに良いと思います。
deadsnakes ppa をインストールしsudo add-apt-repository ppa:deadsnakes/ppa
てアップデートしました。しかし、以前のバージョンの python をインストールしようとすると、依存関係の問題が発生しました (おそらく、focal パッケージであるため)
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.
答え1
自分でコンパイルする必要があります。以下を使用してください:
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
は<version>
有効な Python バージョンです (例 ) 3.7.0
。