11
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Python2 で get-pip.py で SyntaxError

Last updated at Posted at 2018-08-07

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
11
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?