centos7.4上安裝python3及pip3


centos7.4 mini安裝沒有圖形,關閉selinux和firewall。系統默認是python2.7

[root@controller ~]# python
Python 2.7.5 (default, Aug  4 2017, 00:39:18) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

python的模塊安裝方法是easy_install或pip,系統上默認沒有。

1、安裝企業擴展yum

yum install epel-release -y

yum search easy_install

有如下的結果:

python2-pip.noarch : A tool for installing and managing Python 2 packages
python34-pip.noarch : A tool for installing and managing Python3 packages

 yum install python34-pip

就可以使用pip3安裝python3的相關軟件包了。

[root@controller ~]# python
python      python2     python2.7   python3     python3.4   python3.4m  
[root@controller ~]# pip3
pip3    pip3.4 

如果不是搞OpenStack等,還是使用python3吧。

python2同python3的一個差異是

3要加括弧print ()

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM