Confused with installing per-user in Windows

Ivan Pozdeev vano at mail.mipt.ru
Sun Nov 6 20:39:20 EST 2016


On 07.11.2016 4:11, ddbug wrote:
> Dear experts,
>
> I need to install some scripts for current user (to skip sudo, UAC popups and whatever).
>
> So I make a sdist and use python -m pip install --user ....
>
> This should work for either Python 2 or 3.
>
> On Linux, pip installs the scripts into ~/.local/bin ; users are instructed to add this to their PATH if they have not done so already.
>
> In Windows, the user-local directory for scripts is %APPDATA%\Python\Scripts. It is not in PATH by default and finding it is hard (because Microsoft made it hidden in their infinite wisdom).
>
> But more to this, either Python (2.7 or 3.5) will NOT look there by default. When user types "python myscript.py" or "py myscript.py" he is baffled by "not found".
If `myscript.py' is in the system-wide Scripts (or anywhere else other 
that current dir), "python myscript.py" will yield "not found" all the same.
>
> Now, the question:
>
> 1. would it be good if python interpreter could JUST find user-local scripts - by default or by some easy configuration option?
Just append `%APPDATA%\Python\Scripts' into your user-specific PATH and 
use "myscript.py" (without "python") - that will search for the file on 
PATH and run it with whatever program you have associated with the `.py' 
extension (which should be `py.exe' if you're using it).
>
> 2. If not, would it be good to put this smartness into the PY.EXE launcher, make this behavior default or by a simple command line option?
>
> So that user can be instructed to type "py myscript [.py]"  and it will JUST work, if the script is on existing PATH or in the per-user directory?
>
>
> I know about bdist_wininst and Windows specific install options, but prefer single sdist installer whenever possible.
>
> Thanks for reading.
>
> --d

-- 
Regards,
Ivan




More information about the Python-list mailing list