[Python-Dev] Python install layout and the PATH on win32

Glenn Linderman v+python at g.nevcal.com
Wed Mar 21 00:35:32 CET 2012


On 3/20/2012 4:25 PM, Mark Hammond wrote:
> I think it does.  Consider I've installed Python as a "system 
> install".  Now I want to install some other package - ideally that 
> installer will request elevation - all well and good - the .py files 
> are installed. However, next time I want to run Python, it will fail 
> to generate the .pyc files - even though I'm an administrator.  I 
> would need to explicitly tell Python to execute "as administrator" (or 
> run it from an already elevated command-prompt) to have things work as 
> expected.  Thus, the "usual" case would be that Python is unable to 
> update any files in its install directory.
>
> If Python installed for a single user didn't install into Program 
> Files (which it probably couldn't do without an administrator 
> providing credentials anyway) then it wouldn't be a problem - but then 
> we have multiple possible default install locations, which sounds like 
> more trouble than it is worth...
>
>> That said, there is an open bug in the tracker about the insecurity
>> of a system install of python (exactly that the files are writable
>> by anyone).  So that would have to be solved first.  I'd say this
>> is definitely a separate issue from Van's discussion, and the *only*
>> reason one might want to tie them together at all is "well, we're
>> changing the directory layout anyway". 

Indeed, the single user "place" isn't a single place, unless you 
consider the per-user $APPDATA environment variable sufficient to 
determine it (or the Windows API that returns the initial boot up value 
of $APPDATA/ %APPDATA%, which is the preferred technique for code).  But 
it does solve the security problem (stuff in APPDATA is accessible only 
to a single login by default).  So that might be justification for 
putting it there, for single users.

For multi-user installs, %PROGRAMFILES% is appropriate, but, like I've 
heard some Linux distributions do, *.pyc might have to be prebuilt and 
installed along with Python (or generated during install, instead of 
waiting for first use).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120320/83d45f1c/attachment.html>


More information about the Python-Dev mailing list