Thanks. 2010/4/13 Joson <zhuchu...@gmail.com>
> thanks a lot. you've saved my life... > > 2010/4/10 Chris Fuller <cful...@thinkingplanet.net> > > >> I'm using Debian. Used to be etch, but I did a double dist-upgrade >> recently. >> So, whatever the current testing release is. My shell is zsh, but bash >> should >> work the same. >> >> PYTHONPATH should have worked. CLASSPATH is for Java. >> >> >> Here's the documentation link you want: >> http://docs.python.org/install/index.html#inst-search-path >> http://docs.python.org/library/site.html >> >> >> Files that end in ".pth" are read by Python and the contents are added to >> sys.path. >> >> >> 0 % python >> Python 2.5.5 (r255:77872, Feb 1 2010, 19:53:42) >> [GCC 4.4.3] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import sys >> >>> '/home/cfuller/tmp' in sys.path >> False >> >> 0 % export PYTHONPATH=/home/cfuller/tmp >> 0 % python >> Python 2.5.5 (r255:77872, Feb 1 2010, 19:53:42) >> [GCC 4.4.3] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import sys >> >>> '/home/cfuller/tmp' in sys.path >> True >> >> >> What I prefer to do, rather than mucking around with environment variables >> (which isn't reliable, say if its called from a daemon, init script, or >> maybe >> a non-interactive shell, and probably other esoterica) is to use .pth >> files. >> These are just a listing of directories for Python to add to sys.path. A >> lot >> of packages include some of their own, you should find some in >> site-packges. >> Used to be you had to put them there to get them loaded, but there is new >> per- >> user support in Python 2.6 and 3k: >> http://www.python.org/dev/peps/pep-0370/. >> >> 0 % export PYTHONPATH= >> 0 % python >> Python 2.5.5 (r255:77872, Feb 1 2010, 19:53:42) >> [GCC 4.4.3] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import sys >> >>> '/home/cfuller/tmp' in sys.path >> >> >> 0 % mkdir -p ~/.local/lib/python2.6/site-packages >> 0 % echo /home/cfuller/tmp > ~/.local/lib/python2.6/site-packages/tmp.pth >> 0 % python2.6 >> Python 2.6.5 (r265:79063, Mar 18 2010, 23:38:15) >> [GCC 4.4.3] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import sys >> >>> '/home/cfuller/tmp' in sys.path >> True >> >> >> >> Cheers >> >> >> On Friday 09 April 2010, Joson wrote: >> > Hi all, >> > >> > How to append a path ("/var/myprog/src") to sys.path, but not in the >> > dynamic way like sys.path.apend(packpath), please? >> > I use debian os. and I'd tried to set the classpath in /etc/profile >> (export >> > CLASSPATH="..."), and the pythonpath too (export PYTHONPATH="..."). I >> found >> > it didn't work. >> > >> > Best regards, >> > >> > Joson >> > >> >> _______________________________________________ >> Tutor maillist - Tutor@python.org >> To unsubscribe or change subscription options: >> http://mail.python.org/mailman/listinfo/tutor >> > >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor