How to insert my own module in front of site eggs?

Roy Smith roy at panix.com
Thu Nov 17 09:09:34 EST 2011


In article <1s1fp8-6la.ln1 at pluto.solar-empire.de>,
 Marc Christiansen <usenet at solar-empire.de> wrote:

> > So, is there any way to get my local copy of mongoengine loaded instead 
> > of the system egg?  I could probably import sys, and do an egg-ectomy on 
> > sys.path before importing mongoengine, but that's too gross to 
> > contemplate.
> 
> The only way I found is to edit the easy_install.pth file and comment
> the two lines starting with "import sys". You'll have to do that every
> time you install/upgrade an egg via easy_install (and maybe setuptools).
> In your case the right file should be
> /usr/local/lib/python2.6/dist-packages/easy_install.pth
> 
> BTW: You could try pip (http://www.pip-installer.org/) instead of
> easy_install, it doesn't mess with sys.path.

But, you're talking about installers.  I'm talking about if I've already 
got something installed, how do I force one particular python process to 
pull in a local copy of a module in preference to the installed one?

In some cases, I own the machine and can make changes to /usr/local/lib 
if I want to.  But what about on a shared machine?  I don't want to (or 
perhaps can't) play with what's in /usr/local/lib just to make my stuff 
load first.



More information about the Python-list mailing list