Erreur : Le packstack La commande a échoué avec un message d'erreur tel que "ImportError :Aucun module nommé ConfigParser". J'ai donc essayé d'installer ConfigParser en utilisant Python PIP, mais l'installation a échoué comme indiqué ci-dessous.
$pip install ConfigParser Collecting ConfigParser Downloading configparser-3.3.0r2.tar.gz Complete output from command python setup.py egg_info: from configparser import ConfigParser File "/tmp/pip-build-vks_efrb/ConfigParser/configparser.py", line 397 _KEYCRE = re.compile(ur"%\(([^)]+)\)s") SyntaxError: invalid syntax Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vks_efrb/ConfigParser
Quel pourrait être le problème ?
Solution :
J'ai cherché sur Google et trouvé un post@StackOverflow - où la meilleure réponse est "Dans Python version 3.x, ConfigParser le module a été renommé configparser dans le cadre du PEP (Python Enhancement Proposals) 8 ”
Cela signifie que le package en cours d'installation ne prend pas en charge Python version 3.x. Eh bien, j'ai récemment installé Python 3.5.1. Je vais revenir à l'ancienne version de Python et voir si l'erreur disparaît.
Vérifier la version de Python
$python --version Python 3.5.1
Et avait lié /usr/local/bin/python à python3.5 .
ls -l /usr/local/bin/python lrwxrwxrwx 1 root root 9 Dec 11 15:19 /usr/local/bin/python -> python3.5
Relier Python à Python 2.7
Je vais maintenant rétablir python retour à Python version 2.7 et voir si je peux installer ConfigParser .
$unlink python $ln -s /usr/local/bin/python2.7 python
$ls -l python lrwxrwxrwx 1 root root 24 Jan 6 18:53 python -> /usr/local/bin/python2.7
Installation de ConfigParser via pip install
Maintenant, le python par défaut la commande est liée à python2.7 . Installons ConfigParser
$pip install ConfigParser Collecting configparser Using cached configparser-3.3.0r2.tar.gz Building wheels for collected packages: configparser Running setup.py bdist_wheel for configparser Stored in directory: /root/.cache/pip/wheels/1a/3e/f9/d34006ad6b1edfe5006aa704f5ee305c553344a7a6d8550c29 Successfully built configparser Installing collected packages: configparser Successfully installed configparser-3.3.0.post2
Alto! Cela a fonctionné.