在Ubuntu 16.04版本中,系统默认安装 了python 2.7和3.5版本,此次安装的是新版本Python 3.6.13。由于系统已经默认安装了Python,所以相关的依赖文件已经安装妥善,如若缺少依赖文件,请查看缺少的文件。所需的依赖文件及安装如下:
sudo apt-get install openssl
sudo apt-get install libssl-dev
sudo apt-get install libc6-dev gcc
sudo apt-get install -y make build-essential zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm tk-dev
1. 安装Python3.6
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
python3 get-pip.py
apt-get install python3.6-dev
2. 修改默认Python
将默认的Python Python3 链接指向Python3.6
安装完后,查看 /usr/bin 下的文件,已安装的Python有以下三个版本python2.7 python3.5 python3.6
注:需要把原本存在的Python链接删去,重新建立软链接至Python 3.6
至此Ubuntu 16.04下安装Python 3.6.5完毕。
test@test-3630:/usr/bin$ ls -lh python*
lrwxrwxrwx 1 root root 9 8月 26 11:22 python -> python3.6
lrwxrwxrwx 1 root root 9 12月 28 2020 python2 -> python2.7
-rwxr-xr-x 1 root root 3.4M 10月 6 2020 python2.7
lrwxrwxrwx 1 root root 9 8月 25 20:58 python3 -> python3.6
-rwxr-xr-x 2 root root 4.3M 10月 10 2020 python3.5
-rwxr-xr-x 2 root root 4.3M 10月 10 2020 python3.5m
-rwxr-xr-x 2 root root 4.6M 2月 21 2021 python3.6
lrwxrwxrwx 1 root root 33 2月 21 2021 python3.6-config -> x86_64-linux-gnu-python3.6-config
-rwxr-xr-x 2 root root 4.6M 2月 21 2021 python3.6m
lrwxrwxrwx 1 root root 34 2月 21 2021 python3.6m-config -> x86_64-linux-gnu-python3.6m-config
lrwxrwxrwx 1 root root 10 12月 28 2020 python3m -> python3.5m
test@test-3630:/usr/bin$ python --version
Python 3.6.13
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)