Le 20/09/2016 à 12:35, Paul Moore a écrit :
While on the whole subject of this, I should also point out that there are a lot of potential issues with installing new packages while a Python program is running. They are all low-probability, and easy to avoid if you're not doing weird things, but for a generally-promoted mechanism, we need to explain the corner cases[2], and an approach with a list of caveats longer than the main documentation is problematic.
1. If the install fails, you need to catch that and report it to the user, in a more friendly manner than pip's output. For example if the user has no C compiler and you need a C extension to be built. 2. You quite possibly want to suppress pip's output if it's *not* a failure, as it'll clutter up the program's real output. 3. If the code has already imported foo.bar, then you install a new version of foo (there are discussions as to whether pip install foo should automatically imply --upgrade, so even if it won't do that by default now, it might in the future), and maybe that new version doesn't have a bar submodule. So now you have a weird mix of old and new code in your process. 4. The install mechanism sometimes (I can't recall the details) caches the fact that it couldn't import a module. If it does that and then later you pip install that module, imports will still fail because the information is cached.
you forget the use of a linux where it will fail with high probability because by default, pip need to have super user right