Re: Python 3.6 on Windows - does a python3 alias get created by installation?
smart.thanks. On 2019/10/12 12:19 下午, Gisle Vanem wrote: An "alias" could also simply be created using: doskey python3=f:\ProgramFiles\Python36\python.exe -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.6 on Windows - does a python3 alias get created by installation?
On 10/11/19, Gisle Vanem wrote: > > An "alias" could also simply be created using: >doskey python3=f:\ProgramFiles\Python36\python.exe That's a console alias [1], which gets evaluated by the console host process (conhost.exe) when the target process does a normal read via ReadConsoleW or ReadFile. By default doskey.exe creates an alias for "cmd.exe" processes. In the above case, if you enter a line in CMD's prompt that starts with "python3" (ignoring initial whitespace), CMD will instead read "f:\ProgramFiles\Python36\python.exe" from the console input buffer. There are obvious limitations. Since it matches at the start of a line of input, we can't pipe to an alias; or run it on the right-hand side of the &, &&, or || operators; or use it as a command in a `FOR /f` loop; or control how it executes via the START command. Also, since it's only implemented for reads from the current console, it can't be used as a command in a batch script, i.e. CMD will read "python3" from the batch file, not "f:\ProgramFiles\Python36\python.exe". [1] https://docs.microsoft.com/en-us/windows/console/addconsolealias -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.6 on Windows - does a python3 alias get created by installation?
Eryk Sun wrote: The simplest way to create a shell link is via the Windows GUI shell, Explorer. To inherit the working directory of the parent process, leave the link's "start in" field empty. Also, add ".LNK" to the system PATHEXT environment variable to allow finding link files without having to include the ".lnk" file extension, i.e. to be able to run "python3.lnk <...>" as just "python3 <...>". An "alias" could also simply be created using: doskey python3=f:\ProgramFiles\Python36\python.exe -- --gv -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.6 on Windows - does a python3 alias get created by installation?
On 10/9/19, Malcolm Greene wrote: > > @Dan: Yes, symlinks would be a good work around. Assuming the file system supports symlinks (e.g. NTFS, but not FAT32), a relative symlink in the directory beside python.exe works fine, e.g. "python3.exe" -> "python.exe". Putting the symlink in another directory will not work unless you also symlink "python36.dll", "python3.dll", and "vcruntime140.dll". The problem is that loader doesn't resolve the application directory as the final path, so these DLLs won't be found unless they're all symlinked together. Symlinks can be created via Python's os.symlink, CMD's mklink, or PowerShell's new-item with "SymbolicLink" as the ItemType and the target as its Value. Typically you need SeCreateSymbolicLinkPrivilege, which can be granted to you or one of your groups (e.g. the Authenticated Users group). When the privilege is obtained this way, an administrator doesn't have to elevate to create symlinks. If the target is in another directory, the better solution in Windows is a shell link (i.e. a ".lnk" file), aka a "shortcut". Shell links work via the Windows shell API ShellExecuteExW. Console shells such as CMD and PowerShell fall back on ShellexecuteExW if CreateProcessW fails. The simplest way to create a shell link is via the Windows GUI shell, Explorer. To inherit the working directory of the parent process, leave the link's "start in" field empty. Also, add ".LNK" to the system PATHEXT environment variable to allow finding link files without having to include the ".lnk" file extension, i.e. to be able to run "python3.lnk <...>" as just "python3 <...>". -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.6 on Windows - does a python3 alias get created by installation?
Thanks Paul and Dan. @Paul: Yes, it *IS* a bit confusing . Your pip explanation hit the spot. @Dan: Yes, symlinks would be a good work around. Malcolm -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.6 on Windows - does a python3 alias get created by installation?
No, the Windows builds do not provide versioned executables (python3.exe or python3.7.exe). Generally, the recommended way to launch Python on Windows is via the py.exe launcher (py -3.7, or just py for the default), but if you have Python on your PATH then python works. The reason pip has versioned executables is because that's how pip defines its entry points. It's cross-platform and unrelated to the conventions the Python core installers follow. Yes, it's all a bit confusing :-) Paul On Wed, 9 Oct 2019 at 17:37, Malcolm Greene wrote: > > I'm jumping between Linux, Mac and Windows environments. On Linux and Mac we > can invoke Python via python3 but on Windows it appears that only python > works. Interestingly, Windows supports both pip and pip3 flavors. Am I > missing something? And yes, I know I can manually create a python3 alias by > copying python.exe to python3.exe but that approach has its own set of > nuances on locked down servers plus the hassle of keeping these python3 > copies up-to-date across Python updates. > > Also curious: Do the Windows versions of Python 3.7 and 3.8 provide a python3 > alias to start Python? > > Thanks! > Malcolm > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.6 on Windows - does a python3 alias get created by installation?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Malcolm Greene wrote: > I'm jumping between Linux, Mac and Windows environments. On Linux and > Mac we can invoke Python via python3 but on Windows it appears that > only python works. Interestingly, Windows supports both pip and pip3 > flavors. Am I missing something? And yes, I know I can manually create > a python3 alias by copying python.exe to python3.exe but that approach > has its own set of nuances on locked down servers plus the hassle of > keeping these python3 copies up-to-date across Python updates. > > Also curious: Do the Windows versions of Python 3.7 and 3.8 provide a > python3 alias to start Python?. > > Thanks! > Malcolm Linux (and presumably Mac) just set "python" and "python3" as symlinks to various flavors of python2.x or 3.x. Setting up a couple of links / shortcuts should be equally possible on a windows box. -BEGIN PGP SIGNATURE- iQEzBAEBCAAdFiEEBcqaUD8uEzVNxUrujhHd8xJ5ooEFAl2eDg8ACgkQjhHd8xJ5 ooHYxggAsozJWO9OQtXApE0AeG9H1HW7y3cRUyXIX7OxrgnAKxusnPq5uiyZYFEs c1pYlwi1xkO2m0dDL9sB1BF3fOQn3h6HjH2jsdN5M/qTK4EiZ5sIiWXy/VyeN6Sf PzjLx8a8n4qt53yifKN7YBdnPIgyKLY1FSpyvpwc0hWndX70soapU2J4NJtNoIuj MxnKr3KJGynr5XemBiMWNtzv9bPWxPaA5kytaSzOXpVS8Dc7I9ToJe2Dtb/nNGDu nI3nYa3GnGGDN/HEaVbEq5Jq+oj7vtYiR9lUoqxn+Jes8D+Ga6Dg5zBvMQ3DTVac 53m4B9VaPop1mpm8Ba3mW/x2Cvp9nw== =yPoj -END PGP SIGNATURE- -- |_|O|_| |_|_|O| Github: https://github.com/dpurgert |O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5 4AEE 8E11 DDF3 1279 A281 -- https://mail.python.org/mailman/listinfo/python-list