[Python-Dev] Thoughts on running Python 3.5 on Windows (path, pip install --user, etc)

Donald Stufft donald at stufft.io
Mon Mar 9 17:35:44 CET 2015


> On Mar 9, 2015, at 11:37 AM, Steve Dower <Steve.Dower at microsoft.com> wrote:
> 
> Paul Moore wrote:
>> I just thought I'd give installing Python 3.5 a go on my PC, now that
>> 3.5a2 has come out. I didn't get very far (see earlier message) but it prompted
>> me to think about how I'd use it, and what habits I'd need to change.
>> 
>> I'd suggest that the "what's new in 3.5" document probably needs a section on
>> the new installer that explains this stuff...
> 
> This is true. Right now I'm in experimentation mode, and being more aggressive about changing things than is probably a good idea (because it solicits feedback like this :) ). When things settle down I expect to end up closer to where we started, so there's not a huge amount of value in writing it all up right now. I'll get there.
> 
>> First of all, I always use "all users" installs, so I have Python in "Program
>> Files" now. As a result, doing "pip install foo" requires elevation. As that's a
>> PITA, I probably need to switch to using "pip install --user". All that's fine,
>> and from there "py -3.5" works fine, as does "py -3.5 -m foo". But even if it
>> is, not every entry point has a corresponding "-m" invocation (pygments'
>> pygmentize command doesn't seem to, for example)
> 
> I know you're already involved in this Paul, but for everyone else there's a big discussion going on at https://github.com/pypa/pip/issues/1668 about changing pip's default behaviour to handle falling back to --user automatically.
> 
>> But suppose I want to put Python 3.5 on my PATH. The installer has an "add
>> Python to PATH" checkbox, but (if I'm reading the WiX source right, I didn't
>> select that on install) that doesn't add the user directory. So I need to add
>> that to my PATH. Is that right? And of course, that means I need to *know* the
>> user site directory ($env:LOCALAPPDATA\Python\Python35\Scripts), correct?
> 
> Correct. There's no way to add a per-user directory to PATH from an all-users installation (except for a few approaches that I expect/hope would trigger malware detectors...)
> 
>> Maybe the answer is that we simply start recommending that everyone on Windows
>> uses per-user installs. It makes little difference to me (beyond the fact that
>> when I want to look at the source of something in the stdlib, the location of
>> the file is a lot harder to remember than C:\Apps\Python34\Lib\whatever.py) but
>> I doubt it's what most people will expect.
> 
> I'm okay with this. Installing for all users is really something that could be considered an advanced option rather than the default, especially since the aim (AIUI) of the all-users install is to pretend that Python was shipped with the OS. (I'd kind of like to take that further by splitting things more sensibly between Program Files, Common Files and System32, but there's very little gain from that and much MUCH pain as long as people are still expecting C:\PythonXY installs…)

Maybe the answer is to write up a PEP and standardize the idea of entry points, specifically the console_scripts and ui_scripts (or whatever it’s called) entrypoints and then give Python something like -m, but which executes a specific entry point name instead of a module name (or maybe -m can fall back to looking at entry points? I don’t know).

I’ve given this like… 30s worth of thought, but maybe:

    pip install pygmentize  # Implicit —user
    py -e pygmetize

Is an OK UX for people to have without needing to add the user site bin directory to their PATH. Maybe it’s a horrible idea and we should all forget I mentioned it :)

---
Donald Stufft
PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150309/032e7c72/attachment-0001.sig>


More information about the Python-Dev mailing list