Python升级3.8版本完整教程,避免踩坑
有些linux服务器默认是python2.7版本的,需要升级到3.8版本以上才能更好的服务,我在升级的过程中踩了一些坑。比如各种依赖没有,各种莫名其妙的报错。整理了一份完美无脑升级的连环命令,依次输入运行就可以了。
首先安装一些依赖,必须要做这一步,不然就会出现你在升级的时候莫名其妙的报错
Ubuntu/Debian:
1 | 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 python-openssl |
Fedora/CentOS/RHEL:
1 | sudo yum install zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel |
下载python3.8安装包
1 | wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz |
创建安装目录
1 | mkdir /usr/lib/python3.8 |
开始安装python(使用make安装)
1 | cd Python-3.8.3 |
回到主路径
cd
创建默认python链接
1 | ls -l /usr/bin/python |
创建默认pip链接
1 | sudo rm /usr/bin/pip |
至此,完成。现在你可以输入python来查看是否是3.8版本。
- Title: Python升级3.8版本完整教程,避免踩坑
- Author: Metabok
- Created at : 2023-09-20 19:36:36
- Updated at : 2024-05-10 15:22:22
- Link: https://metabok.net/posts/8982.html
- License: This work is licensed under CC BY-NC-SA 4.0.
Comments