Bonjour
Etant débutant en langage Python, j'ai essayé d'installer le module gadfly sous Windows XP ; pour cela, m'inspirant des indications de G. Swinnen (page 306 de son tutoriel pdf), j'ai récupéré en http://sourceforge.net/projects/gadfly le fichier-archive comprimé "gadflyZip.zip" que Winrar a décompressé en créant à ma demande un répertoire "...gadflyZip\gadflyZip" qui contient notamment (comme attendu) un fichier setup.py.
J'ai alors ouvert une fenêtre DOS (invite de commandes), me suis placé (par une série de commandes dir) dans le répertoire "...gadflyZip\gadflyZip" et j'ai lancé la commande indiquée par Swinnen :
python setup.py install
Le système a réagi en écrivant, dans la fenêtre DOS, les 4 lignes suivantes :
Traceback (most recent call last):
File "setup.py", line 4, in ?
from distutils.core import setup
ImportError: No module named distutils.core
ce qui me donne à penser que l'installation a échoué.
Pour éclaircir la situation, voici les 6 premières lignes du fichier "...gadflyZip\gadflyZip\setup.py" :
1 2 3 4 5 6 7
|
#!/usr/local/bin/python
import os, string, sys
from distutils.core import setup
from distutils.command.build_scripts import build_scripts
from glob import glob |
A toutes fins utiles, je précise que j'ai installé Python version 2.6.4 dans le répertoire "C:\Python26" et je liste ici le contenu complet (avec sa hiérarchie, généré par un petit programme VB personnel) du sous-répertoire "C:\Python26\Lib\distutils" (j'ai teint ici en rouge gras les 2 seuls sous-répertoires de celui-ci et en marron le fichier C:\Python26\Lib\distutils\core.py) :
command :
__init__.py
__init__.pyc
bdist.py
bdist_dumb.py
bdist_msi.py
bdist_rpm.py
bdist_wininst.py
build.py
build_clib.py
build_ext.py
build_py.py
build_scripts.py
build_scripts.pyc
clean.py
config.py
install.py
install_data.py
install_egg_info.py
install_headers.py
install_lib.py
install_scripts.py
register.py
sdist.py
upload.py
wininst-6.0.exe
wininst-7.1.exe
wininst-8.0.exe
wininst-8_d.exe
wininst-9.0.exe
wininst-9.0-amd64.exe
tests :
__init__.py
setuptools_build_ext.py
setuptools_extension.py
support.py
test_bdist_wininst.py
test_build_ext.py
test_build_py.py
test_build_scripts.py
test_config.py
test_core.py
test_dist.py
test_filelist.py
test_install.py
test_install_scripts.py
test_msvc9compiler.py
test_register.py
test_sdist.py
test_sysconfig.py
test_upload.py
test_versionpredicate.py
__init__.py
__init__.pyc
.\ : (sous-répertoire lui-même)
archive_util.py
archive_util.pyc
bcppcompiler.py
ccompiler.py
cmd.py
cmd.pyc
config.py
config.pyc
core.py
core.pyc
cygwinccompiler.py
debug.py
debug.pyc
dep_util.py
dep_util.pyc
dir_util.py
dir_util.pyc
dist.py
dist.pyc
emxccompiler.py
errors.py
errors.pyc
extension.py
extension.pyc
fancy_getopt.py
fancy_getopt.pyc
file_util.py
file_util.pyc
filelist.py
log.py
log.pyc
msvc9compiler.py
msvccompiler.py
mwerkscompiler.py
spawn.py
spawn.pyc
sysconfig.py
sysconfig.pyc
text_file.py
unixccompiler.py
util.py
util.pyc
version.py
versionpredicate.py
Quant au contenu du fichier core.py, je liste ici ses lignes 1 à 9 :
1 2 3 4 5 6 7 8 9 10
|
"""distutils.core
The only module that needs to be imported to use the Distutils; provides
the 'setup' function (which is to be called from the setup script). Also
indirectly provides the Distribution and Command classes, although they are
really defined in distutils.dist and distutils.cmd.
"""
# This module should be kept compatible with Python 2.1. |
... puis ses lignes 62 à 93 (début de la définition de la procédure setup) :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
def setup (**attrs):
"""The gateway to the Distutils: do everything your setup script needs
to do, in a highly flexible and user-driven way. Briefly: create a
Distribution instance; find and parse config files; parse the command
line; run each Distutils command found there, customized by the options
supplied to 'setup()' (as keyword arguments), in config files, and on
the command line.
The Distribution instance might be an instance of a class supplied via
the 'distclass' keyword argument to 'setup'; if no such class is
supplied, then the Distribution class (in dist.py) is instantiated.
All other arguments to 'setup' (except for 'cmdclass') are used to set
attributes of the Distribution instance.
The 'cmdclass' argument, if supplied, is a dictionary mapping command
names to command classes. Each command encountered on the command line
will be turned into a command class, which is in turn instantiated; any
class found in 'cmdclass' is used in place of the default, which is
(for command 'foo_bar') class 'foo_bar' in module
'distutils.command.foo_bar'. The command class must provide a
'user_options' attribute which is a list of option specifiers for
'distutils.fancy_getopt'. Any command-line options between the current
and the next command are used to set attributes of the current command
object.
When the entire command-line has been successfully parsed, calls the
'run()' method on each command object in turn. This method will be
driven entirely by the Distribution object (which each command object
has a reference to, thanks to its constructor), and the
command-specific options that became attributes of each command
object.
""" |
Je ne comprends donc pas pourquoi le système a produit le message d'erreur :
ImportError: No module named distutils.core
Pouvez-vous m'aider à débloquer la situation ?
D'avance, un grand merci !
Papy_77
Partager