關於Python的火爆程度,這裏就不用再介紹了,直接開始安裝!而且由於市場上大部分都在使用Python 3,所以我們就直接安裝Python 3.8.1版本!
<!--more-->
一、Windows安裝
本次採用windows 10系統!
1)下載Python軟件包
訪問Python官網!
下載鏈接地址:https://www.python.org/ftp/python/3.8.1/python-3.8.1-amd64.exe
2)安裝Python
Windows系統安裝Python到此結束!
二、Linux安裝Python
本次採用CentOS 7.5 系統!
[root@Python ~]# yum -y install wget gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
#安裝Python所需依賴
[root@Python ~]# wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
#獲取Python軟件包
[root@Python ~]# echo "LANG=zh_CN.UTF-8" >> /etc/profile
[root@Python ~]# echo "LANGUAGE=zh_CN.UTF-8" >> /etc/profile
[root@Python ~]# . /etc/profile
#設置語言的環境變量
[root@Python ~]# tar zxf Python-3.8.1.tgz -C /usr/src
[root@Python ~]# cd /usr/src/Python-3.8.1/
[root@Python Python-3.8.1]# ./configure --prefix=/usr/local/python38 --enable-optimizations && make && make install
#編譯安裝Python
[root@Python Python-3.8.1]# echo "PATH=$PATH:/usr/local/python38/bin" >> /etc/profile
[root@Python Python-3.8.1]# . /etc/profile
#配置python的環境變量
[root@Python Python-3.8.1]# python3 --version
Python 3.8.1
#查看python的版本信息
Linux系統安裝Python到此結束!