如下所示可以看到,pip3还没有添加进系统目录里,因此同样需要做一下软链。
[root@libra-server ~]# pip2 -V pip 9.0.1 from /usr/lib/python2.7/site-packages (python 2.7) [root@libra-server ~]# pip -V pip 9.0.1 from /usr/lib/python2.7/site-packages (python 2.7) [root@libra-server ~]# pip3 -V -bash: pip3: command not found将原来的pip备份,然后把pip3软链到pip,这样以后执行pip就是pip3,pip2就是pip2了:
[root@libra-server ~]# mv /usr/bin/pip /usr/bin/pip.bak [root@libra-server ~]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip [root@libra-server ~]# pip -V pip 19.0.3 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7) 3. 结尾基本上就是这样了,步骤基本上可以分为:
① 安装依赖库并备份原/usr/bin目录下的python
② 下载并编译安装python3
③ 建立python3和pip3的软链
④ 把需要python2的系统文件改写,重新指向python2