[python-win32] sys.path for windows multiple pythons

Zachary Ware zachary.ware+pydev at gmail.com
Wed Mar 22 11:27:03 EDT 2017


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.

>> 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.

-- 
Zach


More information about the python-win32 mailing list