there are 2 reasons: 1. I use both py24 and py25, I don't like to install 2 copies of pyglet, which is a pure python module and can be used by py24/25 at the same time, thus I am not willing to put a module under site-packages, instead I use a separate directory(h:\pure_pylib in my case)
2. I also carry python on my U-disk, as you know the driver letter assigned to it is not always same. so I can't use full path name > ---------- 已转发邮件 ---------- > From: Mike Driscoll <[EMAIL PROTECTED]> > To: python-list@python.org > Date: Mon, 14 Jul 2008 06:12:25 -0700 (PDT) > Subject: Re: a module.pth question > On Jul 14, 6:26 am, oyster <[EMAIL PROTECTED]> wrote: > > My py24 is installed in h:\python24 > > I installed pyglet(http://pyglet.org/) in > > H:\pure_pylib\Multimedia\pyglet-1.0\, if I do > > [code]>>> import sys > > >>> > sys.path.append(r'H:\pure_pylib\Multimedia\pyglet-1.0') > > >>> import pyglet > > > > [/code] > > it is ok. > > > > but if I created h:\pure_pylib\pyglet.pth file, which containts > > [code] > > Multimedia\pyglet-1.0 > > [/code] > > > > then > > [code]>>> import sys > > >>> sys.path.append(r'h:\pure_pylib') > > >>> import pyglet > > > > Traceback (most recent call last): > > File "<stdin>", line 1, in ? > > ImportError: No module named pyglet > > > > [/code] > > > > what is wrong with it? and How to fix it? thanks in advance > > I looked in my easy_install.pth and it looks like it should be: > > .\Multimedia\pyglet-1.0 > > But I don't really see any reason not to do it the way you were > earlier with the full path name. Besides, you should be able to > install pyglet to your site-packages folder. Or you could use buildout > if you're just testing modules and you don't want to screw up your > namespace. > > Mike -- http://mail.python.org/mailman/listinfo/python-list