请问在centos7中如何同时安装python2与python3?
我想让他们两个并存
网友回复
在centos7中自带的是Python2的版本,但是并没有pip的方法,我们需要自行安装 报名为python-pip
# 默认python2的版本 [root@operation ~]# 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. >>> # 安装Python2的pip [root@operation ~]# yum install epel-release -y [root@operation ~]# yum -y install python-pip # 安装完成后不是最新的pip版本要进行升级 [root@operation ~]# pip install --upgrade pip # 测试 [root@operation ~]# pip -V(大写V) pip 18.1 from /usr/lib/python2.7/site-packages/pip (python 2.7) # 现在可以使用pip进行对Python2 进行安装Python包了 # 第一种方法: [root@operation ~]# pip install 包名 # 第二种方法: [root@operation ~]# python -m pip install pymongo (安装Python2的包) # 若是安装的Python3 [root@operation ~]# python3 -m pip install pymongo (安装Python3的包) 下面我们再安装Python3 安装...点击查看剩余70%