Errore: Il pacchetto comando non riuscito con un messaggio di errore come "ImportError:Nessun modulo denominato ConfigParser". Quindi ho provato a installare ConfigParser usando Python PIP, ma l'installazione non è riuscita come mostrato di seguito.
$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
Quale potrebbe essere il problema?
Soluzione:
Ho cercato su Google e ho trovato un post@StackOverflow, dove la risposta migliore dice "In Python versione 3.x, ConfigParser il modulo è stato rinominato in configparser come parte di PEP (Python Enhancement Proposals) 8 ”
Significa che il pacchetto installato non supporta Python versione 3.x. Bene, di recente ho installato Python 3.5.1:lo riporterò alla versione precedente di Python e vedrò se l'errore scompare.
Verifica la versione di Python
$python --version Python 3.5.1
E aveva collegato /usr/local/bin/python a python3.5 .
ls -l /usr/local/bin/python lrwxrwxrwx 1 root root 9 Dec 11 15:19 /usr/local/bin/python -> python3.5
Collegamento di Python a Python 2.7
Ora ripristinerò python torna a Python versione 2.7 e vedere se riesco a installareConfigParser .
$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
Installazione di ConfigParser tramite installazione pip
Ora, l'impostazione predefinita python il comando è collegato a python2.7 . Installiamo 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
Viola! Ha funzionato.