[PYTHON] Histoires et solutions pour la mise à jour de l'AWS CLI

"Au fait, je n'ai pas mis à jour l'AWS CLI." J'ai pensé comme ça et j'ai essayé de mettre à jour. Ensuite, j'ai été accro par inadvertance à ...


Tout d'abord, exécutez la mise à jour normalement ...

[ore@server ~]$ sudo pip install --upgrade awscli
Collecting awscli from https://pypi.python.org/packages/py2.py3/a/awscli/awscli-1.8.4-py2.py3-none-any.whl#md5=f7a52bd35ff7ed1b8eede7cb82049f39
  Downloading awscli-1.8.4-py2.py3-none-any.whl (769kB)
    100% |################################| 770kB 3.5MB/s
Requirement already up-to-date: colorama<=0.3.3,>=0.2.5 in /usr/lib/python2.6/site-packages (from awscli)
Requirement already up-to-date: docutils>=0.10 in /usr/lib/python2.6/site-packages (from awscli)
Collecting argparse>=1.1 from https://pypi.python.org/packages/2.7/a/argparse/argparse-1.4.0-py2.py3-none-any.whl#md5=c37216a954c8669054e2b2c54853dd49 (from awscli)
  Downloading argparse-1.4.0-py2.py3-none-any.whl
Requirement already up-to-date: rsa<=3.1.4,>=3.1.2 in /usr/lib/python2.6/site-packages (from awscli)
Collecting botocore==1.2.2 (from awscli)
  Downloading botocore-1.2.2-py2.py3-none-any.whl (1.8MB)
    100% |################################| 1.8MB 3.0MB/s
Requirement already up-to-date: pyasn1>=0.1.3 in /usr/lib/python2.6/site-packages (from rsa<=3.1.4,>=3.1.2->awscli)
Collecting ordereddict==1.1 (from botocore==1.2.2->awscli)
  Downloading ordereddict-1.1.tar.gz
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help
    error: invalid command 'egg_info'
    Complete output from command python setup.py egg_info:
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

       or: -c --help [cmd1 cmd2 ...]

       or: -c --help-commands

       or: -c cmd --help



    error: invalid command 'egg_info'

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-dBji6C/ordereddict

J'ai décidé de chercher la solution sur le net parce que "c'est une erreur". "Je vois, je devrais mettre à jour ce qu'on appelle setuptools." (* Référence 1)

[ore@server ~]$ sudo pip install --upgrade setuptools
Collecting setuptools from https://pypi.python.org/packages/3.4/s/setuptools/setuptools-18.3.1-py2.py3-none-any.whl#md5=a21a4d02d0bab2eac499cca72faeb076
  Downloading setuptools-18.3.1-py2.py3-none-any.whl (462kB)
    100% |################################| 462kB 1.5MB/s
Installing collected packages: setuptools
  Found existing installation: setuptools 0.6rc11
    Can't uninstall 'setuptools'. No files were found to uninstall.

Successfully installed setuptools-0.6rc11

Après avoir terminé la mise à jour de setuptools, essayez à nouveau de mettre à jour le cli aws ...

[ore@server ~]$ sudo pip install --upgrade awscli
Collecting awscli from https://pypi.python.org/packages/py2.py3/a/awscli/awscli-1.8.4-py2.py3-none-any.whl#md5=f7a52bd35ff7ed1b8eede7cb82049f39
  Using cached awscli-1.8.4-py2.py3-none-any.whl
Requirement already up-to-date: colorama<=0.3.3,>=0.2.5 in /usr/lib/python2.6/site-packages (from awscli)
Requirement already up-to-date: docutils>=0.10 in /usr/lib/python2.6/site-packages (from awscli)
Collecting argparse>=1.1 from https://pypi.python.org/packages/2.7/a/argparse/argparse-1.4.0-py2.py3-none-any.whl#md5=c37216a954c8669054e2b2c54853dd49 (from awscli)
  Using cached argparse-1.4.0-py2.py3-none-any.whl
Requirement already up-to-date: rsa<=3.1.4,>=3.1.2 in /usr/lib/python2.6/site-packages (from awscli)
Collecting botocore==1.2.2 (from awscli)
  Using cached botocore-1.2.2-py2.py3-none-any.whl
Requirement already up-to-date: pyasn1>=0.1.3 in /usr/lib/python2.6/site-packages (from rsa<=3.1.4,>=3.1.2->awscli)
Collecting ordereddict==1.1 (from botocore==1.2.2->awscli)
  Using cached ordereddict-1.1.tar.gz
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help
    error: invalid command 'egg_info'
    Complete output from command python setup.py egg_info:
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

       or: -c --help [cmd1 cmd2 ...]

       or: -c --help-commands

       or: -c cmd --help



    error: invalid command 'egg_info'

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-HzKUun/ordereddict

** "Oh, la même erreur? Il a été écrit que si vous faites cela, ce sera guéri!" ** (Ne blâmez pas les autres) J'ai donc décidé d'étudier une autre méthode (* Référence 2).

[ore@server ~]$ curl -O http://python-distribute.org/distribute_setup.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[ore@server ~]$ sudo python distribute_setup.py
python: can't open file 'distribute_setup.py': [Errno 2] No such file or directory
[ore@server ~]$

J'ai pensé: "C'est bizarre. Pourquoi n'y a-t-il pas de fichier?" Et j'ai essayé d'y accéder directement avec un navigateur ...

http://python-distribute.org/distribute_setup.py → http://ww43.python-distribute.org/distribute_setup.py

"Oh, je suis redirigé ... Eh bien, ** le domaine est à vendre! C'est pourquoi aucun fichier ne peut être téléchargé !! **"

J'ai donc décidé d'enquêter davantage pendant que j'étais sur le point de pleurer. Puis il y avait! La solution est!

[ore@server ~]$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
--2015-09-16 11:58:39--  https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
Resolving bitbucket.org... 131.103.20.167, 131.103.20.168
Connecting to bitbucket.org|131.103.20.167|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11434 (11K) [text/plain]
Saving to: “ez_setup.py”

100%[==========================================================>] 11,434      --.-K/s   in 0s

2015-09-16 11:58:40 (333 MB/s) - “ez_setup.py” saved [11434/11434]

[ore@server ~]$ sudo python ez_setup.py
Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-18.3.1.zip
Extracting in /tmp/tmprVQjOi
Now working in /tmp/tmprVQjOi/setuptools-18.3.1
Installing Setuptools
running install
running bdist_egg
running egg_info
(snip...)
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
creating dist
creating 'dist/setuptools-18.3.1-py2.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing setuptools-18.3.1-py2.6.egg
Copying setuptools-18.3.1-py2.6.egg to /usr/lib/python2.6/site-packages
Adding setuptools 18.3.1 to easy-install.pth file
Installing easy_install script to /usr/bin
Installing easy_install-2.6 script to /usr/bin

Installed /usr/lib/python2.6/site-packages/setuptools-18.3.1-py2.6.egg
Processing dependencies for setuptools==18.3.1
Finished processing dependencies for setuptools==18.3.1

"Peut-être que c'est cool?"

[ore@server ~]$ sudo pip install --upgrade awscli
Collecting awscli from https://pypi.python.org/packages/py2.py3/a/awscli/awscli-1.8.4-py2.py3-none-any.whl#md5=f7a52bd35ff7ed1b8eede7cb82049f39
  Using cached awscli-1.8.4-py2.py3-none-any.whl
Requirement already up-to-date: colorama<=0.3.3,>=0.2.5 in /usr/lib/python2.6/site-packages (from awscli)
Requirement already up-to-date: docutils>=0.10 in /usr/lib/python2.6/site-packages (from awscli)
Collecting argparse>=1.1 from https://pypi.python.org/packages/2.7/a/argparse/argparse-1.4.0-py2.py3-none-any.whl#md5=c37216a954c8669054e2b2c54853dd49 (from awscli)
  Using cached argparse-1.4.0-py2.py3-none-any.whl
Requirement already up-to-date: rsa<=3.1.4,>=3.1.2 in /usr/lib/python2.6/site-packages (from awscli)
Collecting botocore==1.2.2 (from awscli)
  Using cached botocore-1.2.2-py2.py3-none-any.whl
Requirement already up-to-date: pyasn1>=0.1.3 in /usr/lib/python2.6/site-packages (from rsa<=3.1.4,>=3.1.2->awscli)
Collecting ordereddict==1.1 (from botocore==1.2.2->awscli)
  Using cached ordereddict-1.1.tar.gz
    /tmp/pip-build-kYyZ1w/ordereddict/setup.py:12: DeprecationWarning: Parameters to load are deprecated.  Call .resolve and .require separately.

(snip...)

  Found existing installation: awscli 1.7.45
    Uninstalling awscli-1.7.45:
      Successfully uninstalled awscli-1.7.45

Successfully installed argparse-1.4.0 awscli-1.8.4 botocore-1.2.2 ordereddict-1.1 simplejson-3.3.0
[ore@server ~]$ aws --version
aws-cli/1.8.4 Python/2.6.6 Linux/2.6.32-504.1.3.el6.centos.plus.x86_64

"J? ai compris ...!"


Pour résumer brièvement, cela a été résolu en DLing this et en exécutant sudo python ez_setup.py! !! (* Référence 3) Merci Jameel Grand!

J'espère que cette dépendance résoudra les soucis de quelqu'un.


référence:

  1. http://kaworu.jpn.org/python/pip#.E8.A7.A3.E6.B1.BA.E6.96.B9.E6.B3.95_2
  2. http://blog.gogo-games.com/archives/28446278.html
  3. http://stackoverflow.com/questions/31719816/pip-fails-to-install-anything-error-invalid-command-egg-info

Recommended Posts

Histoires et solutions pour la mise à jour de l'AWS CLI
Procédure d'installation de l'AWS CLI
À propos de «Lamvery», un outil de déploiement et de gestion pour AWS Lambda
Problèmes et solutions à la demande de MySQL db dans Python 3
Lutte contre les noms de fichiers japonais: Rubymine, AWS CLI, Docker pour Windows (1) --AWS CLI