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