python报错:Python 2.7 will reach the end of its life on January 1st, 2020.

环境描述

  • centos 7

错误描述

    在使用centos7的时候,使用pip安装的时候,可能会报错:

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.

    是由于centos7默认安装了python2.7,但是python2.7的生命周期到2020年1月1日就会结束,所以是使用不了pip进行安装的。

解决办法

    解决方法就是将python2升级为python3,推荐使用此链接的方法进行安装升级:cnblogs.com,已经测试实现过,确认解决有效。
    注意:更改之后,执行python文件时,需要把头部的代码更改如下:

# 更改前
# !/usr/bin/python

# 更改后
# !/usr/bin/python3
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐