Python environment on mac
Crane Ugly
vostrushka at gmail.com
Tue Jul 26 09:52:01 EDT 2016
Mac OS X comes with its own version of python and structure to support it.
So far it was good enough for me. Then I started to use modules that distributed through MacPorts and this is where I get lost.
I do not quite understand how Python environment is set. Or how to set it in a way of using, say MacPorts distribution alone.
For example: standard location for pip utility is /usr/local/bin/pip. MacPorts structure has it too but as a link
lrwxr-xr-x 1 root admin 67 May 23 22:32 /opt/local/bin/pip-2.7 -> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pip
Which means that the standard utility will be used.
The things is that depending on a way I run pip I get different results:
$ pip list|grep pep8
pep8 (1.7.0)
$ sudo pip list|grep pep8
$
pep8 was installed through macports.
In second case pip is using stripped environment and pointing to standard Mac OS Python repository.
But in a way to install anything with pip I have to use sudo.
In my profile I have variable PYTHONPATH:
PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
It is pointing to macports structure. But when I use sudo (in case of using pip) it get stripped.
How to setup and maintain python environment in a trustful way? So it is clear where all installed modules are?
Leonid
More information about the Python-list
mailing list