codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with Python install on Windows 10


On 1/13/20, Mike Weaver <miweaver at gmail.com> wrote:
>
> I've tried downloading from https://www.python.org/downloads/windows/
> (the Windows x86-64 executable installer
> <https://www.python.org/ftp/python/3.8.1/python-3.8.1-amd64.exe>)
> and running that. Again says it is installed - but it clearly isn't.

Maybe you didn't enable the option to add the installation directory
to PATH. Modifying the system and per-user PATH value is easy enough
-- especially in Windows 10, which provides an exploded view of the
semicolon-delimited list of directories, with individual entries that
you can edit or move up and down in the list.

> If I open a command prompt and type 'python', I get
>
> TCC: (Sys) The file cannot be accessed by the system
> "C:\Users\Mike\AppData\Local\Microsoft\WindowsApps\python.exe"
>
> If I search in that directory, I find a <SYMLINK> to python.exe. I have

That's the app-exec link for the store version of Python, which, if
it's not installed, actually targets a stub app that opens the
Microsoft Store to install Python. The directory of the standard
installation needs to precede "%LocalAppData%\Microsoft\WindowsApps"
in PATH in order to avoid this app-exec link. The default installation
directory for x64 3.8 would be "%ProgramFiles%\Python38" for a system
install and "%LocalAppData%\Programs\Python\Python38" for a per-user
install.

Note that an app-exec link is a type of filesystem reparse point, like
a symlink or mount point in that narrow aspect, but it is most
definitely not a symlink. Your shell is wrong to report that it's a
"<SYMLINK>". There's no kernel handler for this type of reparse point,
so any attempt to open it normally, with reparsing enabled, will fail
as an unhandled reparse point. As far as I know, no Cygwin-derived
environment (e.g. MSYS2) has been updated to support app-exec links.
The onus is on these frameworks to stay up to date with significant
changes in Windows.

CreateProcess handles app-exec links in user mode. It directly opens
the reparse point to read the target executable path. It also reads a
set of security attributes, which it adds to a custom access token for
the child process (i.e it's like a CreateProcessAsUser call). The
security attributes in the access token allow the child process to
access the app's files in "%ProgramFiles%WindowsApps\<app directory>",
which are protected by a conditional access-control entry.