1. 程式人生 > 其它 >Ubuntu 18.04 + Python2.7 安裝 Python3.4.0

Ubuntu 18.04 + Python2.7 安裝 Python3.4.0

技術標籤:linuxpythonUbuntu

參考1
參考2

  1. 準備
apt-get install build-essential checkinstall
apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
  1. 下載
wget https://www.python.org/ftp/python/3.4.0/Python-3.4.0.tgz
tar xzf Python-3.4.0.tgz
  1. 安裝
    將python3.4.0移動至/usr/bin/
cp python3.4  /usr/bin/
./configure --enable-shared
make
make install
  1. 更新一下替代列表,將 python2.7 和 python3.4 放入其中
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
update-alternatives --install /usr/bin/python python /usr/bin/python3.4 2
  1. 確認
    檢視python版本
python -V
  1. 錯誤
    報錯
apt-get install libssl-dev

apt-get install openssl