PYTHONPATH x *.pth???

"Martin v. Löwis" martin at v.loewis.de
Thu Sep 4 21:56:16 CEST 2003


Carlos Moreira wrote:

> I want to install Python third packages in a
> non-default directory.
> What´s the better way?
> 
>    - PYTHONPATH variable?
>    - *.pth files in site-packages?

It depends on your requirements. For example:

- Why is it that you don't want to install the
   packages in the default directory? Then, considering
   that reason, why would it be acceptable to install
   a .pth file there?

- Is it acceptable that users of your application set
   PYTHONPATH?

- Do you have to consider multiple installations of Python

And so on.

You should also consider a third alternative:

    - Extend sys.path explicitly in the application,
      before importing the third package.

> I know that the two methos above are equivalents. But
> what method will be keep in future Python releases
> (for example)?

Both with be kept indefinitely.

Regards,
Martin





More information about the Python-list mailing list