python:Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Py

mistake

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 pip 21.0 will 
remove support for this functionality.
 

Cause Analysis:

The default python environment is 2.7, and pip will prompt that Python 2.7 reached the end of its life on January 1st, 2020. during installation, so we need to change the operating environment.
In other words, what we installed with pip at this time was installed under python3.

solution:

1. Check the default python address and return to /usr/bin/python

$ which python

2. Check the corresponding version and return to Python 2.7.17

$ /usr/bin/python -V

3. Similar operations, get the address of Python3 and the corresponding version number

$ which python3
$ /usr/bin/python3

4. Next we write a configuration file:

$ gedit ~/.bash_profile

Write in it:

PATH="/usr/bin:${PATH}"
export PATH
alias python="/usr/bin/python3"

Then save and exit

$ source ~/.bash_profile

5. Then enter python to run in the python3 environment.

Guess you like

Origin blog.csdn.net/zhizhengguan/article/details/130430248