sudo apt update sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
curl -O https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
tar -zxvf Python-3.8.0.tgz
cd Python-3.8.0
./configure --prefix=/usr/local/python3
make && make install
四、設置軟連接
ln -sf /usr/local/python3/bin/python3.8 /usr/bin/python3
ln -sf /usr/local/python3/bin/pip3.8 /usr/bin/pip3
最後驗證
可能存在的問題:
如果pip3異常,請卸載python2,然後重新編譯python3.8