0

With Python 2.6.8 and 2.7.10 (plus anaconda installs etc.) on my Mac, I needed to install 2.6.6 32-bit (long story), so I installed it from dmg. With luck, when I then typed python2.6 in a shell, the 2.6.6 interpreter started (though only in that tab, not in others - perhaps this is significant?).

I then needed to install some modules, needing to make sure that they were got installed for this newly-in-place 2.6.6, not any other install. So I took the approach outlined here, namely:

sudo easy_install-2.6 pip

I then installed my desired module using pip2.6:

sudo pip2.6 install py2app==0.5.2

When I went to run py2app using python2.6:

python2.6 setup.py py2app

It complained that setuptools was not installed. So as before,

sudo pip2.6 install setuptools

But once again:

MacBook-Pro-de-Pyderman:projet Pyderman$ python2.6 setup.py py2app
Traceback (most recent call last):
  File "setup.py", line 98, in <module>
    mac_setup()
  File "setup.py", line 46, in mac_setup
    from setuptools import setup
ImportError: No module named setuptools

So .... pip2.6 is installing modules, just not for 2.6.6. Is there a step I am missing, in order to ensure that python 2.6.6 is the default home for modules downloaded with pip2.6? Or is pip2.6 the wrong approach here?

As requested:

MacBook-Pro-de-Pyderman:project Pyderman$ which -a python2.6    
/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 
/usr/bin/python2.6 
/usr/local/bin/python2.6 

MacBook-Pro-de-Pyderman:project Pyderman$ which -a pip2.6 
/usr/local/bin/pip2.6

Note: I will eventually move to using pyenv and/or virtualenv, but for now, I'm looking to achieve this without them.

Community
  • 1
  • 1
Pyderman
  • 14,809
  • 13
  • 61
  • 106

1 Answers1

1

This should work for you, please open a new terminal for executing these commands:

cd /tmp
wget https://bootstrap.pypa.io/get-pip.py
sudo /Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 get-pip.py

After that both pip2.6 and python2.6 should point to your 2.6.6 interpreter.

The command which python2.6 should print

/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6

The command which pip2.6 should print

/Library/Frameworks/Python.framework/Versions/2.6/bin/pip2.6
cel
  • 30,017
  • 18
  • 97
  • 117
  • Thanks. Getting this though when I try execute get-pip.py: `/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 get-pip.py` ..... *Could not find a version that satisfies the requirement pip (from versions: ) No matching distribution found for pip* – Pyderman Jan 14 '16 at 21:53
  • Not sure if this is relevant, but `python` now starts the Python **2.6.6** interpreter, while `python2` starts Python **2.7.10** – Pyderman Jan 14 '16 at 21:59
  • @Pyderman, I added sudo in the last command. Bug from my side - sorry for that. I do not understand, why pip does not find a suitable version. Unfortunately, building 2.6.6 from the source is weirdly complex and requires a lot of hacks. I do not have the time/motivation to see if I can reproduce your error. – cel Jan 14 '16 at 22:52
  • Adding `sudo` had no affect, I'm afraid. I appreciate your time and effort though, and if no-one else chimes in with a solution, the chosen answer will be yours. – Pyderman Jan 14 '16 at 23:40