티스토리 뷰

이슈사항

setuptools 의 버전 문제로 현재 유지보수가 이루어지지 않는 python 2.7을 사용하려 할때 다음과 같은 syntax 에러를
맞이하는 경우가 있다.

[vagrant@localhost ~]$ pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/da/f6/c83229dcc3635cdeb51874184241a9508ada15d8baa337a41093fab58011/pip-21.3.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-ULXlXy/pip/setup.py", line 7
        def read(rel_path: str) -> str:
                         ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ULXlXy/pip/
You are using pip version 8.1.2, however version 21.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

해결방법

이와 같은 경우 https://bootstrap.pypa.io/ 경로 하단에 2.7용 get-pip.py 파일을 다운로드 받아
이를 기반으로 pip version up을 수행하면 된다.
(참고로 https://bootstrap.pypa.io/2.7/get-pip.py 파일로 소개된 경우가 있었는데 URL이 변경된듯하다. 하여 지속적으로 사용하려한다면 파일을 따로 보관하길 권장한다)

[vagrant@localhost ~]$ curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1863k  100 1863k    0     0  4366k      0 --:--:-- --:--:-- --:--:-- 4374k

[vagrant@localhost ~]$ python get-pip.py
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.
Defaulting to user installation because normal site-packages is not writeable
Collecting pip<21.0
  Using cached pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.3.4
    Uninstalling pip-20.3.4:
      Successfully uninstalled pip-20.3.4
Successfully installed pip-20.3.4
[vagrant@localhost ~]$ pip -V
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

이후 get-pip.py 실행시 출력된 20.3.4 버전으로 업그레이드를 수행한다.

[vagrant@localhost ~]$ sudo pip install --upgrade pip==20.3.4
Collecting pip==20.3.4
  Downloading https://files.pythonhosted.org/packages/27/79/8a850fe3496446ff0d584327ae44e7500daf6764ca1a382d2d02789accf7/pip-20.3.4-py2.py3-none-any.whl (1.5MB)
    100% |################################| 1.5MB 1.1MB/s
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Uninstalling pip-8.1.2:
      Successfully uninstalled pip-8.1.2
Successfully installed pip-20.3.4
You are using pip version 20.3.4, however version 21.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

이후 다른 package 설치시 문제없이 설치가 된다.

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
글 보관함