Help us understand the problem. What is going on with this article?

Python2 で get-pip.py で SyntaxError

More than 1 year has passed since last update.

pipのインストールに際して、Python2系だとSyntaxエラーが出るようです。
Pythonの新しいバージョンが入れられない場合は、以下のように対応できます。

環境

# cat /etc/redhat-release
CentOS release 6.9 (Final)
# python -V
Python 2.6.6

やりたかったこと

Linux に AWS Command Line Interface をインストールします
ここの
pip のインストール

現象

# python get-pip.py
Traceback (most recent call last):
  File "get-pip.py", line 20651, in <module>
    main()
  File "get-pip.py", line 197, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    import pip._internal
  File "/tmp/tmp8OYExX/pip.zip/pip/_internal/__init__.py", line 42, in <module>
  File "/tmp/tmp8OYExX/pip.zip/pip/_internal/cmdoptions.py", line 16, in <module>
  File "/tmp/tmp8OYExX/pip.zip/pip/_internal/index.py", line 536
    {str(c.version) for c in all_candidates},
                      ^
SyntaxError: invalid syntax

解決策

$ curl -O https://bootstrap.pypa.io/get-pip.py
↓
$ curl -O https://bootstrap.pypa.io/2.6/get-pip.py
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away