Where to manually place extra python resources

Jeremy Lavergne jeremy at lavergne.gotdns.org
Wed Mar 20 09:54:37 PDT 2013


> An application written in python wants to import a python library not presently included among MacPorts' ports.

I would just add it to MacPorts then.

> The library in question is hl7 which parses health care-related messages encoded in HL7 v 2.x and available from
> 
> 	https://pypi.python.org/pypi/hl7/0.2.5
> 
> I have had success by placing the untarred directory (hl7) and its subjacent files (__init__.py, client.py) in the same directory as the app's launcher, but only because the launcher shell script adds that directory to PYTHONPATH.
> 
> Is there some more "standard" place under Mac OS where I can relocate the hl7 library so that my MacPorts python can find it? I have already tried placing it under each of the following, with no luck:
> 
> 	/opt/local/Library/Frameworks/Python.framework/
> 	/opt/local/Library/Frameworks/Python.framework/Resources

Well, `pip install --user` puts things into the user-site. Python's documentation (PEP 370 - Per user site-packages directory) says [1]:
On Mac OS X Python uses ~/.local directory as well. Framework builds of Python include ~/Library/Python/2.6/site-packages as an additional search path.

 [1] http://www.python.org/dev/peps/pep-0370/



More information about the macports-users mailing list