Install Python on CentOS 7

1. update the yum package repository cache of your CentOS7 machine:

sudo yum makecache

2. install yum-utils package:

sudo yum install -y yum-utils

3. add the IUS package repository:

sudo yum install -y https://centos7.iuscommunity.org/ius-release.rpm

4. update the yum package repository cache again:

sudo yum makecache

5. install python3.6
  • only python
    sudo yum install -y python36u
  • python including pip for python3.6
    sudo yum install -y python36u python36u-pip
  • test whether python3.6 works
    python3.6 -V
  • test whether pip for python3.6 works
    pip3.6 -V
6. change python version on the fly

alias python3=$(which python3.x)
now you can access python3.x with the python3 as following:
python3 -V

That`s all. Thanks for reading !

猜你喜欢

转载自blog.csdn.net/junlaiyan/article/details/85916926