[Distutils] The future of invoking pip

Tim Golden mail at timgolden.me.uk
Fri Nov 6 09:56:34 EST 2015


On 06/11/2015 14:46, Nathaniel Smith wrote:
> On Nov 6, 2015 5:39 AM, "Paul Moore" <p.f.moore at gmail.com
> <mailto:p.f.moore at gmail.com>> wrote:
>>
>> On 6 November 2015 at 12:10, Donald Stufft <donald at stufft.io
> <mailto:donald at stufft.io>> wrote:
>> > Doesn’t py.exe just look at some ini files and environment variables
> to decide what to invoke? I’m not sure why we couldn’t just replicate
> that behavior. Is there something that py.exe does that we can’t also do
> in Python?
>>
>> What's there might be possible in Python, but there are some nasty
>> special cases. The launcher code looks in the registry, and in order
>> to support running both 32 and 64 bit Pythons from the same launcher
>> exe, it needs to play tricks to see both the 32 and 64 bit registry
>> values, and I'm not sure the APIs to do that are exposed to Python so
>> it may need ctypes.
>>
>> Doable certainly, easy not so sure. We could of course do a simplified
>> version and not try to be precisely equivalent to the launcher
>> behaviour - but that may also cause user confusion. The simplest cases
>> are easy, it's the corner cases that get nasty.
> 
> One option would be to add a "py -which" mode that just does the
> configuration lookup and then prints the path to the real python
> executable. This would add the cost of one subprocess startup per pip,
> but not 6?

FWIW this will do that:

  py -c "import sys; print(sys.executable)"

TJG


More information about the Distutils-SIG mailing list