linux install python 3.7.4

Select Version

  • Click Download official direct https://www.python.org/downloads/
  • Here now choose the latest version of 3.7.4
  • If you bother to choose you can also choose to modify their own version number

download

//替换自己需要的版本
export DOWNLOAD_PYTHON_VERSION=3.7.4 
wget https://www.python.org/ftp/python/$DOWNLOAD_PYTHON_VERSION/Python-$DOWNLOAD_PYTHON_VERSION.tgz

installation

  • Version 3.7 requires a new package libffi-devel The following command is installed by default
//定义安装目录 根据自己情况修改
export PYTHON_DIR=/usr/local/python 

//开始安装并创建软链、下面命令一起复制
yum install libffi-devel -y  \
&& tar -zxvf Python-$DOWNLOAD_PYTHON_VERSION.tgz \
&& cd Python-$DOWNLOAD_PYTHON_VERSION \
&& ./configure --prefix=$PYTHON_DIR \
&& sudo make \
&& sudo make install \
&& sudo ln -s $PYTHON_DIR/bin/python3 /usr/bin/python3

verification

  • Simple few lines of command installed successfully
  • Is not it easy to see what version below
  • You can also make your own test environment to reduce duplication of work docker mirrored save
python3 --version
//显示版本
Python 3.7.4
Released nine original articles · won praise 459 · views 160 000 +

Guess you like

Origin blog.csdn.net/songhait/article/details/96301853