[Pythonmac-SIG] How to provide additions to python path such thatall executions of a given python binary will see them?

Ronald Oussoren ronaldoussoren at mac.com
Thu Jun 24 14:00:32 EDT 2004


On 24-jun-04, at 16:27, Mario Ruggier wrote:

> On Jun 22, 2004, at 4:25 PM, Ronald Oussoren wrote:
>> On Friday, June 18, 2004, at 02:55AM, Kenneth McDonald  
>> <kenneth.m.mcdonald at sbcglobal.net> wrote:
>>
>>> Currently, I modify my python path through inclusion of a PYTHONPATH
>>> variable
>>> in the .login file. However, I need to add a /local/python/packages
>>> directory
>>> to the path in such a manner that all executions of the system python
>>> binary
>>> see /local/python/packages. I was just wondering up the best (least
>>> hacky)
>>> way of doing this might be.
>>
>> create /Library/Python/2.3/local.pth containing the line  
>> /local/python/packages.
>>
>> The exact name of the file is not important, as long as it has the  
>> suffix '.pth'.
>
> What exactly should /Library/Python/2.3/local.pth contain? I.e. what  
> is the syntax for adding a dir to pythonpath in this way?

The file should contain one or more directory names, seperated by  
newlines.

>
> And, are the effects of doing it this way different than the way that  
> Jack has just posted, that is to add env. variables to  
> ~/.MacOSX/environment.plist that are then read at login time?

Jack's method is a per-user setting, mine is system-wide.

>
> In my /Library/Python/2.3 directory, the README says:
> ====
> This directory exists so that 3rd party packages can be installed
> here.  Read the source for site.py for more details.
> ====
> But, there is no site.py ? Where should this be?

$ python -c 'import site; print site.__file__[:-1]'
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/ 
site.py
>
> mario
>
>
>> Ronald
>>>
>>> Thanks,
>>> Ken McDonald
>
>
--
X|support bv            http://www.xsupport.nl/
T:  +31 610271479       F:  +31 204416173




More information about the Pythonmac-SIG mailing list