[python-win32] sys.path for windows multiple pythons
Robin Becker
robin at reportlab.com
Wed Mar 22 13:08:11 EDT 2017
On 22/03/2017 15:27, Zachary Ware wrote:
> On Wed, Mar 22, 2017 at 10:14 AM, David Rock <david at graniteweb.com> wrote:
>>
>>> On Mar 22, 2017, at 09:48, Robin Becker <robin at reportlab.com> wrote:
>>>
>>> do I get extra stuff from c:\Python27 because those folders are in my execution PATH variable;
>>
>> Yes; that’s how Windows works.
>
> No; that's not how Python works. Python does not care about PATH, but
> it does care about PYTHONPATH. PYTHONPATH should not be set
> permanently; it should only ever be set by a virtual environment or
> temporarily to add a particular directory to sys.path.
>
yes I think it's the PYTHONPATH that's doing this. I don't think I have added it
though and python seems to work happily without having any pythonpath set.
>>> seems a bit dodgy to have those folders ending up in a python 3.6 environment.
>>
>> Python isn’t going to replace your path, it’s going to append to it. If you have the python27 stuff in your path, python36 has no way of knowing the path info is “dodgy.” As far as it knows, that’s completely acceptable information.
>>
>> Is it actually causing an issue, or does it just look odd?
>
> Including "C:\Python27" and "C:\Python27\Scripts" in PYTHONPATH isn't
> going to cause much issue, because the actual libraries are in
> C:\Python27\Lib and C:\Python27\DLLs. You would be able to attempt to
> import from the 2.7 standard library by importing, for example,
> Lib.argparse, though.
>
I haven't noticed any real oddness, but it causes a bit of worry that something
might go wrong.
--
Robin Becker
More information about the python-win32
mailing list