Issue with Python Path. "ImportError: No module named setuptools"


Question

I recently updated to Python 2.7 in order to start working with Django "Django requires Python, specifically Python 2.6.5 - 2.7.x."

As a result I needed to install some of the tools I have been using when I went through the excellent LPTHW Exercise 46

  1. pip from http://pypi.python.org/pypi/pip
  2. distribute from http://pypi.python.org/pypi/distribute
  3. nose from http://pypi.python.org/pypi/nose/
  4. virtualenv from http://pypi.python.org/pypi/virtualenv

Should be easy enough, I had done it all before...

When I run python in terminal I get the below. Note: Python 2.7.5

$ python
Python 2.7.5 (v2.7.5:ab05e7dd2788, May 13 2013, 13:18:45) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

When I type "which python" I get

$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python

However when I try to install distribute, nose or virtualenv I get the below error. Note Python/2.6

$ sudo pip install distribute
Exception:
Traceback (most recent call last):
File "/Library/Python/2.6/site-packages/pip-1.3.1-py2.6.egg/pip/basecommand.py", line 139, in main
status = self.run(options, args)
File "/Library/Python/2.6/site-packages/pip-1.3.1-py2.6.egg/pip/commands/install.py", line 258, in run
import setuptools
ImportError: No module named setuptools

Storing complete log in /Users/brendanspillane/Library/Logs/pip.log
localhost:~ brendanspillane$ 

I believe the Python/2.6 is the issue here. As a result i tried to set my Python Path (my first time) Using this question as a reference "changing python path on mac?" i typed in

PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" 
export PATH

This has no apparent effect.

However I am still not able to run sudo pip install distribute and keep getting the same error.

Can anyone help me? Is it my Python Path? or am I looking in the wrong direction?

Any help is as always, much appreciated.

Deepend

1
2
5/23/2017 11:59:30 AM

Accepted Answer

I'm not really sure how it worked but it did. @Robert Lujo deserves the up votes for his answer at https://stackoverflow.com/a/16511140/1214163

If the answer is also added here i will accept it.

5
5/23/2017 12:07:47 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon