0

Using the /usr/local/bin install for Python 2.6.7 to keep it separate from Python 2.6.1 (see Upgrade Python to 2.6 on Mac), my new 2.6.7 binary isn't finding my 2.6 modules when I try to run code. As far as I understood, 2.6.1 and 2.6.7 should share modules because both are 2.6 modules.

ImportError: No module named unicodecsv

If I want to use my new /usr/local/bin/python (2.6.7) to run my program with modules I pip installed while using 2.6.1, what crucial step am I missing? A path issue? Using /usr/bin/python still imports the module without an issue.

I've confirmed that /usr/local/bin/pip install unicodecsv (and pip-2.6 install) just tells me I already have what I need:

Requirement already up-to-date: unicodecsv in /Library/Python/2.6/site-packages
4
  • What does running both of the Python's show, when run using eg: python -c "import sys; print sys.path" Commented Feb 20, 2013 at 19:55
  • Oh yes, that's definitely where I've failed. The 2.6.7 path is missing /Library/Python/2.6/site-packages among other things. Forgive my ignorance, I'm still a raging Python newbie ... is sys.path the same as PYTHONPATH? Commented Feb 20, 2013 at 20:02
  • Have a look at stackoverflow.com/questions/11697517/… Commented Feb 20, 2013 at 20:11
  • Modules playing nice now that I have PYTHONPATH set up properly. Thank you! Commented Feb 20, 2013 at 20:14

1 Answer 1

0

Use python -c "import sys; print sys.path" on the well-behaved binary that knows where the modules are to get correct paths. (thank you, Jon Clements.)

Create or update the PYTHONPATH environment variable to capture these paths so that your new binary is searching the right places.

In bash, for example, just add it to .bash_profile: EXPORT PYTHONPATH=path:from:above:sys_path:inquiry

And then re-execute to activate: . ~/.bash_profile

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.