新配置了一个环境,pip默认安装的为21.0.1,使用时直接报如下错误:文章源自堕落的鱼-https://www.duoluodeyu.com/2650.html
[root@duoluodeyu ~]# pip install qcloudapi-sdk-python
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==21.0.1', 'console_scripts', 'pip')()
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 561, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2631, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2291, in load
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2297, in resolve
File "/usr/lib/python2.7/site-packages/pip-21.0.1-py2.7.egg/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax文章源自堕落的鱼-https://www.duoluodeyu.com/2650.html
文章源自堕落的鱼-https://www.duoluodeyu.com/2650.html
报错原因:文章源自堕落的鱼-https://www.duoluodeyu.com/2650.html
Python 2.7 已于2020年1月1日到期,请停止使用。请升级您的Python,因为不再维护Python 2.7。pip 21.0将于2021年1月停止对Python 2.7的支持。pip 21.0将删除对此功能的支持。文章源自堕落的鱼-https://www.duoluodeyu.com/2650.html
解决办法:文章源自堕落的鱼-https://www.duoluodeyu.com/2650.html
将pip降级,可以考虑降到pip 20.3.4版本。可执行下面两条指令:文章源自堕落的鱼-https://www.duoluodeyu.com/2650.html
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py文章源自堕落的鱼-https://www.duoluodeyu.com/2650.html
python get-pip.py文章源自堕落的鱼-https://www.duoluodeyu.com/2650.html