赞
踩
os: centos 7.4
只安装 python2.x 的情况下,pip、pip2 均对应 python2.x,安装在 /usr/lib/pyhont2.x/dist-packages
只安装 python3.x 的情况下,pip、pip3 均对应 python3.x,安装在 /usr/lib/pyhont3.x/dist-packages
同时安装 python2.x、python3.x 的情况下,pip2 对应 python2.x,pip3 对应 python3.x.
pip 还需要通过源码来看对应 python2.x 还是 python3.x
当前 python2.x 已经不受支持。
# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
# yum install python python-devel python-libs
# cd /root;
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py;
python get-pip.py;
# pip install setuptools;
pip install --upgrade setuptools;
# which pip
/usr/bin/pip
# which pip2
/usr/bin/pip2
# ls -l /usr/bin/pip*
-rwxr-xr-x 1 root root 220 May 5 00:00 /usr/bin/pip
-rwxr-xr-x 1 root root 220 May 5 00:00 /usr/bin/pip2
-rwxr-xr-x 1 root root 220 May 5 00:00 /usr/bin/pip2.7
# /usr/bin/pip -V
pip 20.1 from /usr/lib/python2.7/site-packages/pip (python 2.7)
# /usr/bin/pip2 -V
pip 20.1 from /usr/lib/python2.7/site-packages/pip (python 2.7)
再安装 python3
# yum install python3 python3-devel python3-libs
会安装依赖包 python3-pip, 释放的可执行文件在 /usr/bin 目录下
# repoquery -ql python3-pip |more
/usr/bin/pip-3
/usr/bin/pip-3.6
/usr/bin/pip3
/usr/bin/pip3.6
# cd /tmp;
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py;
python3 get-pip.py;
# pip install setuptools;
pip install --upgrade setuptools;
# which pip
/usr/local/bin/pip
# which pip3
/usr/local/bin/pip3
# ls -l /usr/local/bin/pip*
-rwxr-xr-x 1 root root 221 May 4 23:51 /usr/local/bin/pip
-rwxr-xr-x 1 root root 221 May 4 23:51 /usr/local/bin/pip3
-rwxr-xr-x 1 root root 221 May 4 23:51 /usr/local/bin/pip3.6
# /usr/local/bin/pip -V
pip 20.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
# /usr/local/bin/pip3 -V
pip 20.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
# python -m pip uninstall pip
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Found existing installation: pip 20.1
Uninstalling pip-20.1:
Would remove:
/usr/bin/pip2
/usr/bin/pip2.7
/usr/lib/python2.7/site-packages/pip-20.1.dist-info/*
/usr/lib/python2.7/site-packages/pip/*
Proceed (y/n)? y
Successfully uninstalled pip-20.1
# python3 -m pip uninstall pip
Found existing installation: pip 20.1
Uninstalling pip-20.1:
Would remove:
/usr/local/bin/pip
/usr/local/bin/pip3
/usr/local/bin/pip3.6
/usr/local/lib/python3.6/site-packages/pip-20.1.dist-info/*
/usr/local/lib/python3.6/site-packages/pip/*
Proceed (y/n)?
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。