[Pythonmac-SIG] MacPython & Leopard: Which 'site-packages' folder to use?

Python Nutter pythonnutter at gmail.com
Fri Jun 27 05:53:40 CEST 2008


I take my system to the next level.

I work with the Framework/Reference Python from python.org so I use
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages

However before I had my site-packages folder inundated with installed
modules I installed only Peak Setup Tools and VirtualEnv and because I
like iPython I installed that.

Then using Doug Hellmens wrapper (needed slight modification to the
installation instructions to make it work when moving from a Linux
system to installing it on a Mac OS X system) I have a system where I
can created unlimited "sandoxed" python sessions (projects) each with
their own ability to easy_install or setup.py install any number of
python modules and have them not step on any other virtual python
session (project).

now a simple
$mkvirtualenv WhateverProjectName

will create the folders, partial symlinks into system python, and
automatically install setuptools into my new project's folder and then
switch me into that virtualenv right away

(WhateverProjectname)$_

where I can then easy_install the specific python modules I need just
for that project.

If I want to switch over and work on that new pyglet game I have been
developing a simple

(WhateverProjectname)$workon MyPygletGameProject
(MyPygletGameProject)$_

gets me out of my sandboxed Project and into my sanboxed PygletGameProject.

Very slick, only way to go.


Mac OS X modifications:

Just edit.bash_profile (OS X) instead of .bashrc (Linux, etc.)

Make a directory in your home folder called .virtualenvs to hold all
your projects you created

$mkdir .virtualenvs

Then store your virtualenvwrapper_bashrc in some directory, I use
Scripts folder with a bash folder in it, all inside my home folder.

Then edit your .bash_profile and add:

# Setting VirtualEnv and VirtualEnvWrapper for Python
export WORK_HOME=$HOME/.virtualenvs
source $HOME/Scripts/bash/virtualenvwrapper_bashrc


And you too can join in on the fun =)

Cheers,
Python Nutter

On 27/06/2008, Larry Meyn <larry.meyn at nasa.gov> wrote:
>
>
>
> On 6/26/08 12:10 PM, "Russell E. Owen" <rowen at cesmail.net> wrote:
>
>> In article
>> <af8ce7040806251515y6647490ei8b9621f1f678dffe at mail.gmail.com>,
>>  "Rob Gabaree" <rob at rawb.net> wrote:
>>
>>> Hello,
>>>
>>> With Leopard's built-in Python, user-installed modules are placed in
>>> /Library/Python/2.5/site-packages/.
>>>
>>> If I'm using MacPython, should I avoid putting anything into this
>>> directory and use
>>> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
>>> instead?
>>>
>>> I'd just like to double check. I noticed the former path wasn't in
>>> sys.path when I looked, but I wasn't sure if it was accidentally left
>>> out by mistake.
>>>
>>> Thanks for the help,
>>
>> If you are using MacPython then use
>> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-pack
>> ages.
>>
>> The two pythons do not share installed packages. This is probably good;
>> you avoid endangering the system python and you can upgrade to python
>> 2.6 or 3.0 when you are ready without installing packages that are
>> incompatible with the system python.
>>
>> -- Russell
>>
>
> Additional Info:
> While you can use the system python and install modules in
> /Library/Python/2.5/site-packages/, you cannot install new versions of the
> pre-installed modules that are stored in
> /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/
> (You can install new versions, but the system python checks its own folder
> first.)  Several modules such as numpy and wxPython are in the system
> python's extras library.  Since I like to update these from time to time,
> I've abandoned the system python and use a framework install instead.  One
> drawback to a user-installed python is that you lose access to some
> system-python only modules like CoreGraphics.
>
> --Larry
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>


More information about the Pythonmac-SIG mailing list