Ubuntu 22.04 安裝 python 3.6.8 紀錄
如果直接在 22.04 下載 python3.6 封包並試圖 compile 的話會有以下兩個錯誤
- SSL 模組無法適用
- compile 過程中 core dump
根據這篇文
https://stackoverflow.com/questions/72102435/how-to-install-python3-6-on-ubuntu-22-04
core dump 是因為 22.04 後 gcc11導致的不相容
整理完操作如下
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev \
libgdbm-dev libnss3-dev libedit-dev libc6-dev
apt-get install gcc-10 -y
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
tar -xzf Python-3.6.8.tgz
cd Python-3.6.8
CC="gcc-10" ./configure --enable-optimizations -with-lto --with-pydebug
sudo make altinstall
用這樣的方式再去開 venv
python3.6 -m venv venv3.6
source venv3.6/bin/activate
deactivate