Bootstrap

大数据系列之:CentOS7安装Python3详细步骤

一、下载安装的Python版本

https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz

wget https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz

二、解压缩

tar zxvf Python-3.10.14.tgz

三、设置安装路径

cd Python-3.10.14
./configure --prefix=/usr/local/python3.10.14

四、安装编译需要的包

yum install -y glibc-headers
yum install -y libreadline6-dev gfortran
yum install -y readline-devel
yum install -y wget libXt-devel
yum install -y fonts-chinese tcl tcl-devel tclx tk tk-devel
yum install -y mesa-libGLU mesa-libGLU-devel
yum install -y install bzip2-devel
yum install -y install xz-devel.x86_64
yum install -y install pcre-devel
yum install -y install libcurl
yum install -y install libcurl-devel
yum install -y  texinfo.x86_64
yum install -y texlive-pdftex-doc.noarch
yum install -y texlive
yum install gcc-gfortran

五、编译

make

六、编译安装

make install

七、设置软连接

ln -s /usr/local/python3.10.14 /usr/local/bin/python3

ln -s /usr/local/python3.10.14/bin/pip3 /usr/local/bin/pip3

八、设置环境变量

vim /etc/profile
export PYTHON_HOME=/usr/local/python3.10.14
export PATH=$PYTHON_HOME/bin:$PATH

九、激活环境变量

source /etc/profile

十、执行python命令

python3

十一、安装包

pip3 install 包名
;