Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
386 views
in Technique[技术] by (71.8m points)

Unable to upgrade Pip on Python 2.7.5

I'm trying to upgrade pip to the latest version on Python 2.7.5 on Centos 7.

# python -m pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/9e/24/bc928987f35dd0167f21b13a1777c21b9c5917c9894cff93f1c1a6cb8f3b/pip-21.0.tar.gz
    Complete output from command python setup.py egg_info:
    /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'
      warnings.warn(msg)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-eMN0xl/pip/setup.py", line 85, in <module>
        python_requires='>=3.6',
      File "/usr/lib64/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 269, in __init__
        _Distribution.__init__(self,attrs)
      File "/usr/lib64/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 302, in finalize_options
        ep.load()(self, ep.name, value)
      File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2302, in load
        return self.resolve()
      File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2312, in resolve
        raise ImportError(str(exc))
    ImportError: 'module' object has no attribute 'check_specifier'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-eMN0xl/pip/

I tried upgrading the setup tools as well. However that's failing to

# python -m pip install --upgrade setuptools

Collecting setuptools
 Using cached https://files.pythonhosted.org/packages/84/48/5c99d8770fd0a9eb0f82654c3294aad6d0ba9f8600638c2e2ad74f2c5d52/setuptools-52.0.0.tar.gz
   Complete output from command python setup.py egg_info:
   Traceback (most recent call last):
     File "<string>", line 1, in <module>
     File "setuptools/__init__.py", line 16, in <module>
       import setuptools.version
     File "setuptools/version.py", line 1, in <module>
       import pkg_resources
     File "pkg_resources/__init__.py", line 1367
       raise SyntaxError(e) from e
                               ^
   SyntaxError: invalid syntax
   
   ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ohx4SA/setuptools/

This was working will as of last Friday. However it seems to be broken from the beginning of this week.

Could you please advise on this?

question from:https://stackoverflow.com/questions/65902444/unable-to-upgrade-pip-on-python-2-7-5

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Looks like they have removed support for Python 2.7 with the latest version of Pip.

https://lwn.net/Articles/843945/

If I pin the pip version to 20.3.4, it works fine.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...