服务器环境为Centos6.8,python为默认的2.6.6版本

1.升级python

python2.6.6 升级到python2.7.14,此处不再描述
可以参考如下文档升级:
https://blog.csdn.net/see_you_see_me/article/details/78550977

2.Python导致pip命令不可用

升级Python2.7导致使用pip等命令安装模块失败,报错如下:

#pip
Traceback (most recent call last):File "/usr/bin/pip", line 5, in <module>from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

解决办法可以参考下面的文档,此处也不在详细描述了:
http://linuxsogood.org/816.html

在一外个国人的网站上找到了解决方案:

#curl -O http://python-distribute.org/distribute_setup.py
#/usr/local/pyton2.7/bin/python distribute_setup.py

提示:distribute_setup.py这个脚本文件内容可以找我要

#/usr/local/python2.7/bin/easy_install pip
#/usr/local/python2.7/bin/pip -V
[root@localhost ~]#  /usr/local/python2.7/bin/python distribute_setup.py
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz
Traceback (most recent call last):File "distribute_setup.py", line 537, in <module>sys.exit(main())File "distribute_setup.py", line 533, in maintarball = download_setuptools(download_base=options.download_base)File "distribute_setup.py", line 206, in download_setuptoolssrc = urlopen(url)File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 154, in urlopenreturn opener.open(url, data, timeout)File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 435, in openresponse = meth(req, response)File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 548, in http_response'http', request, response, code, msg, hdrs)File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 473, in errorreturn self._call_chain(*args)File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 407, in _call_chainresult = func(*args)File "/usr/local/python2.7/lib/python2.7/urllib2.py", line 556, in http_error_defaultraise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: SSL is required

[root@localhost ~]# grep DEFAULT_URL distribute_setup.py
DEFAULT_URL = "https://pypi.python.org/packages/source/d/distribute/"
修改此处的地址为:https

[root@localhost ~]#  /usr/local/python2.7/bin/python distribute_setup.py
。。。。。。。。。。。。。。。。。
。。。。。。。。。。。。。。。。。
Installing easy_install script to /usr/local/python2.7/bin
Installing easy_install-2.7 script to /usr/local/python2.7/binInstalled /usr/local/python2.7/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg
Processing dependencies for distribute==0.6.49
Finished processing dependencies for distribute==0.6.49
After install bootstrap.
Creating /usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info
Creating /usr/local/python2.7/lib/python2.7/site-packages/setuptools.pth
[root@localhost ~]# echo $?
0
[root@localhost ~]# find / -name 'easy_install'
/usr/local/python2.7/bin/easy_install
/usr/bin/easy_install

使用新版本的python来运行这个脚本,这个会自动安装出来一个easy_install,然后使用这个新的easy_install来安装pip就可以了!

3.安装pip报错Could not find suitable distribution for Requirement.parse('pip')

error: Could not find suitable distribution for Requirement.parse('pip')[root@localhost ~]# /usr/local/python2.7/bin/easy_install pip
Searching for pip
Reading http://pypi.python.org/simple/pip/
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')

解决文档:https://blog.csdn.net/sunnywuxian/article/details/82870803
解决文档:https://pip.readthedocs.io/en/stable/installing/
解决过程如下:

[root@localhost ~]# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
[root@localhost ~]# python get-pip.py
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting pipDownloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)100% |████████████████████████████████| 1.4MB 151kB/s
Collecting wheelDownloading https://files.pythonhosted.org/packages/96/ba/a4702cbb6a3a485239fbe9525443446203f00771af9ac000fa3ef2788201/wheel-0.33.1-py2.py3-none-any.whl
Installing collected packages: pip, wheelThe script wheel is installed in '/usr/local/python2.7/bin' which is not on PATH.Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-19.0.3 wheel-0.33.1
[root@localhost ~]# /usr/local/python2.7/bin/easy_install pip
Searching for pip
Best match: pip 19.0.3
Adding pip 19.0.3 to easy-install.pth file
Installing pip script to /usr/local/python2.7/bin
Installing pip3.7 script to /usr/local/python2.7/bin
Installing pip3 script to /usr/local/python2.7/binUsing /usr/local/python2.7/lib/python2.7/site-packages
Processing dependencies for pip
Finished processing dependencies for pip
[root@localhost ~]# echo $?
[root@localhost ~]#  /usr/local/python2.7/bin/pip -V
pip 19.0.3 from /usr/local/python2.7/lib/python2.7/site-packages/pip (python 2.7)
[root@localhost ~]# 

到此处pip命令成功安装

转载于:https://blog.51cto.com/wujianwei/2376898

升级python2.6.6到python2.7导致pip命令不可用相关推荐

  1. Centos7配置环境变量导致大部分命令不可用

    解压完jdk后,vim /etc/profile 配置完环境变量, source /etc/profile 后发现大部分命令都用不了了,如: cat,ll,vi,vim等. 显然是PATH的值有问题导 ...

  2. 解决python3与python2的pip命令冲突问题冲突(window版)

    解决方法再上一篇有大概讲解: python开发环境安装配置 这里做一些补充: 上一篇说过,删除python3和python2中的python.exe文件后关闭dos窗口,重新打开dos,就可以进行安装 ...

  3. Win10下python3和python2多版本同时安装并解决pip共存问题

    Win10下python3和python2多版本同时安装并解决pip共存问题 参考文章: (1)Win10下python3和python2多版本同时安装并解决pip共存问题 (2)https://ww ...

  4. Win10下python2和python3同时安装并解决pip共存问题

    Win10下python3和python2同时安装并解决pip共存问题 特别说明,本文是在Windows64位系统下进行的,32位系统请下载相应版本的安装包,安装方法类似. 使用python开发,环境 ...

  5. Win10下python2和python3同时安装并解决pip共存

    特别说明,本文是在Windows64位系统下进行的,32位系统请下载相应版本的安装包,安装方法类似. 使用python开发,环境有Python2和 python3 两种,有时候需要两种环境切换使用,下 ...

  6. Windows下Python2和Python3并存,怎么使用pip

    想学习Python3,但是暂时又离不开Python2.在Windows上如何让它们共存呢? 如何运行Python2和Python3 度娘上大家经常会建议把其中一个python.exe改个名字,这样区分 ...

  7. python2没有pip命令_解决Windows下python和pip命令无法使用的问题

    一. python命令找不到 安装python之后经常会出现下面的问题 , python命令找不到,这是因为Windows的环境变量中没有定义python的安装路径 这个时候我们先找到python的安 ...

  8. pip 升级_python的pip命令

    python中我们会经常使用pip命令来安装一些需要用到的模块,下面我们简单来介绍一下pip命令的具体使用. pip的介绍 pip 是 Python 包管理工具,该工具提供了对Python 包的查找. ...

  9. mysql 密码 特殊符号_MySQL数据库之mysql设置复杂密码中含$特殊符号导致无法命令行登录...

    本文主要向大家介绍了MySQL数据库之mysql设置复杂密码中含$特殊符号导致无法命令行登录 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助. 安全考虑 在设置MYSQL 密码时候 ...

最新文章

  1. red5下nginx安装配置
  2. Java开发者必备的六款工具
  3. setscale方法的用法_基于BigDecimal.setScale的用法小结
  4. 发生生成错误是否继续并运行上次的成功生成_JavaScript 是如何运行的?
  5. Socket简单介绍(通过NSStream)
  6. NPU 2015年陕西省程序设计竞赛网络预赛(正式赛)F题 和谐的比赛(递推 ||卡特兰数(转化成01字符串))...
  7. Excel文件导入mysql数据库
  8. PHP点餐系统源码附小程序点餐系统
  9. python orange3_Anaconda中安装Orange3脚本-完整版
  10. 于朦胧 机器人_机器人演戏?建议于朦胧陈钰琪这部《两世欢》改名:我的面瘫男友...
  11. 彩虹云仿小柯秒赞主题模板
  12. 工程项目管理系统-专注项目数字化管理-工程管理
  13. win10 eclipse适配笔记本4K屏幕
  14. Hive -- Hive面试题及答案(3)
  15. 生成酷炫代码注释(根据图片生成)
  16. poi 读取word文字图片表格
  17. Python递归实现①把嵌套列表压平为一层列表②返回嵌套列表中某元素出现的个数③返回第n个斐波那契数
  18. 古人对梦的解释_中国古代对梦的解释-精选文档
  19. iterm2连接Mac中文显示乱码
  20. 【verilog】 Vivado-Simple Dual-Port RAM IP的使用(Xilinx FPGA,双口RAM,IP使用)

热门文章

  1. SQL Server查询备份日期和备份设备名
  2. ubuntu16.04安装mysql5.7.15
  3. 缓存技术比拼:Redis与Memcached的同与不同
  4. linux下删除乱码文件
  5. 11Grac+ASM+linux2.6.18 processes (100) exceeded
  6. spring之旅第四篇-注解配置详解
  7. WPF:Documents文档--Annomation批注(3)
  8. 数据中设计中的范式与反范式
  9. 办公电脑安装虚拟机基本就绪
  10. oracle 数据库开发应用实例,招生录取系统,oracle与plsql教程打包下载