python 升级后正确安装 pip

由于服务器的python 版本是2.6.6 , 为了使用 twisted 升级至 2.7.13 , 如果此时直接用 yum install python-pip 安装 pip, 则实际pip 会安装在 python 2.6 下, 而使用时可能出现:

No module named pkg_resources
因为这个包被安装在 python 2.6 下。

正确安装对应版本的 pip:

1、卸载原先pip 旧版

2、下载 pip 的安装脚本。https://pip.pypa.io/en/latest/installing/

3、用 python 安装 pip

yum remove python-pip
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
原文地址:https://www.cnblogs.com/zhenfei/p/6668890.html