[Pythonmac-SIG] Beginner's query: Path configuration in OS X 10.3

Bob Ippolito bob at redivi.com
Thu Feb 12 15:13:04 EST 2004


On Feb 12, 2004, at 2:54 PM, Jeffrey Dean wrote:

> I'm just getting started, aiming to learn Python for use in scripting
> FontLab for typeface design. I'm using Lutz & Ascher, _Learning 
> Python_, 2nd
> edn (O'Reilly 2004), which I'm finding really helpful. But I've hit a 
> snag
> very close to the beginning. I have no doubt there's an obvious 
> solution to
> my problem, but I haven't found it yet.
>
> I'm running Python 2.3 in Mac OS X 10.3.2 (I've installed Jack's 
> addons for
> Panther), so Python is located in /System/Library/Frameworks. I can't 
> write
> files to that directory, so I've put my exercise modules in
> /Users/Myname/Documents/Python. How the heck do I get Python to look 
> there
> for modules to import them? Or, alternatively, where should I be 
> saving the
> files so Python can find them? I've read the documentation about 
> PYTHONPATH
> and .pth files, but I can't work out how to use them in OS X 10.3. My 
> Unix
> ability is very rudimentary.

The site-packages in /System/Library/Frameworks/Python.framework is a 
symlink to /Library/Python/2.3, which should be writable by anyone in 
the admin group.

Python also looks in the Library/Python/2.3/site-packages location 
inside your home folder, which is definitely writable even if you are 
not an admin.

You don't need .pth files, they are only a convenience that you can use 
to add additional search locations.  You don't need unix ability, they 
are just plain text files that contain a full unix path to where you 
would like to search.. you could create them from TextEdit an drop them 
into either of the two locations that I just mentioned.

-bob




More information about the Pythonmac-SIG mailing list