I installed python26 using macports, so the correct python on my system is /opt/local/bin/python
However, when I do
sudo pip install
Summarizing the above, installing pip using Macports with:
sudo port install py27-pip
results in an installation of a package named py27-pip.
However, no /opt/local/bin/pip
is installed and port select pip
or port select py27-pip
both fail (in contrast to a port select python
). Changing things in the bin
directory of another distribution is not generally recommended.
Note that /usr/bin
python links point to the pre-installed python by Apple, /usr/local/bin
point to those installed by MacPython from python.org, whereas /opt/local/bin
is where Macports install their links. The actual Library installations can be found by ls -ls
applied to the various python files in each bin
directory).
To ensure that the Macports files are called, export the path for Macports last in your .bash_profile
. For example, if you installed Macports and then happened to install a binary distribution from python.org, you will end having its path later in you ~/.bash_profile
, so it will come first in the path variable and Macpython will be shadowing Macports.
After ensuring that the paths are appropriately set, the system still fails to find a pip
command in the Macports bin
directory, because it is installed as pip-2.7
and no pip
is automatically created.
As a result, the system continues searching the path and if e.g. Macpython is added to the path some place later and has pip installed, then that pip will show up.
This can be avoided by the command proposed above:
sudo ln -s /opt/local/bin/pip-2.7 /opt/local/bin/pip