Could not find platform independent libraries <prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]

10,949

You seem to have things turned around. Virtualenv creates a python environment that encapsulates a python install. So you want to do the following:

  1. Install python
  2. Create a virtualenv using that version of python (eg. virtualenv --python="path to python in 1" virt)
  3. Switch to that virtualenv (workon virt)
  4. Now install Django, etc. inside of the virtualenv virt

Here is the recipe I used to get my environment setup and running.

Are you using homebrew? I've found that's the most reliable way to get stuff on the mac.

Share:
10,949
Alex Garulli
Author by

Alex Garulli

Italian Frontend developer living in London.

Updated on June 05, 2022

Comments

  • Alex Garulli
    Alex Garulli almost 2 years

    I'm really new to Python and Django.... What I'm trying to do is:

    1. Install Python 2.7 on Mac OS 10.6.8

    2. Install pip Install Django

    3. Install virtualenvwrapper

    4. Create virtual environment

    5. Install Django-Cms

    I think, I'll be is ok from Install virtualenvwrapper to the Django-Cms installation because I have already done it, but in the first steps I got some troubles.

    I download Python 2.z from python.org the Python 2.7.3 Mac OS X 64-bit/32-bit x86-64/i386 Installer (for Mac OS X 10.6 and later [2]), installed whit the wizard . That create a directory /System/Library/Frameworks/Python.framework/Versions with inside my 2.7 folder.

    My directory /System/Library/Python is empty

    I'm sure I've Python installed cos:

    python --version
    Python 2.7.3
    

    but when I try easy_install pip it gave me:

    Could not find platform independent libraries <prefix>
    Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
    'import site' failed; use -v for traceback
    Traceback (most recent call last):
      File "/usr/bin/easy_install-2.6", line 7, in <module>
        from pkg_resources import load_entry_point
      File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 16, in <module>
        import sys, os, zipimport, time, re, imp, new
    ImportError: No module named os**
    

    Now no idea of what does mean ...so if somebody could help out from this and put me on the direction where I can istall my virtualenvwrapper I can take it from there.

    I'm Junior a front end developer never touch back end so pls be specific and explain me what I need to do as u speak with a child.