<div dir="ltr">sorry, I did'nt know it allready existed...<div>thank you!</div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-12-22 14:16 GMT+01:00 Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Dec 23, 2014 at 12:06 AM, Liam Marsh <<a href="mailto:liam.marsh.home@gmail.com">liam.marsh.home@gmail.com</a>> wrote:<br>
> """That's suggesting mixing and matching between versions within the same<br>
> process space, which is highly unlikely to work correctly (except when<br>
> modules are specifically designed for that, as indicated by the availability<br>
> of backported versions on PyPI)."""<br>
><br>
> In fact, i was thinking about a small program, which just analize the file<br>
> for these commentaries, and asks the OS to launch the appropriate "real"<br>
> python environnement, and finishes.<br>
<br>
</span>If you just want to have the initial script control its version, then<br>
that can be done. Put an appropriate shebang at the top of the file,<br>
use the py.exe launcher on Windows, and that'll all work.<br>
<span class=""><br>
> This small program will be also be able to chose the appropriate version by<br>
> scanning the import statements, and seeking for these imported modules in<br>
> the different environnements installed.<br>
<br>
</span>Not sure what you mean here, but if you use multiple different<br>
interpreters all installed concurrently, they'll each have their own<br>
separate module trees. Or do you mean different versions of imported<br>
libraries (so you could have, for instance, numpy 1.8.2 for this<br>
project, and numpy 1.9.1 for another)? In that case, you'd do well to<br>
use virtual environments, which cope just fine with this kind of<br>
thing.<br>
<br>
The one thing you *cannot* do easily is have an application request<br>
one Python version, and one of its imported modules request a<br>
different Python version. Similarly if you have two modules that each<br>
import the same third module; the nature of Python's import machinery<br>
is such that they have to get the same version (in fact, the same<br>
module). Within one execution space, you have to be consistent, or<br>
else go through some serious hoop-jumping to keep things separate.<br>
<br>
ChrisA<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</div></div></blockquote></div><br></div>