Thanks.<br><br><div class="gmail_quote">2010/4/13 Joson <span dir="ltr">&lt;<a href="mailto:zhuchunml@gmail.com">zhuchunml@gmail.com</a>&gt;</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&#39;ve saved my life...<br><br><div class="gmail_quote">2010/4/10 Chris Fuller <span dir="ltr">&lt;<a href="mailto:cfuller@thinkingplanet.net" target="_blank">cfuller@thinkingplanet.net</a>&gt;</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&#39;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&#39;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 &quot;.pth&quot; 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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.<br>
&gt;&gt;&gt; import sys<br>
&gt;&gt;&gt; &#39;/home/cfuller/tmp&#39; 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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.<br>
&gt;&gt;&gt; import sys<br>
&gt;&gt;&gt; &#39;/home/cfuller/tmp&#39; in sys.path<br>
True<br>
<br>
<br>
What I prefer to do, rather than mucking around with environment variables<br>
(which isn&#39;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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.<br>
&gt;&gt;&gt; import sys<br>
&gt;&gt;&gt; &#39;/home/cfuller/tmp&#39; in sys.path<br>
<br>
<br>
0 % mkdir -p ~/.local/lib/python2.6/site-packages<br>
0 % echo /home/cfuller/tmp &gt; ~/.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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.<br>
&gt;&gt;&gt; import sys<br>
&gt;&gt;&gt; &#39;/home/cfuller/tmp&#39; 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>
&gt; Hi all,<br>
&gt;<br>
&gt; How to append a path (&quot;/var/myprog/src&quot;) to sys.path, but not in the<br>
&gt;  dynamic way like sys.path.apend(packpath), please?<br>
&gt; I use debian os. and I&#39;d tried to set the classpath in /etc/profile (export<br>
&gt; CLASSPATH=&quot;...&quot;), and the pythonpath too (export PYTHONPATH=&quot;...&quot;). I found<br>
&gt; it didn&#39;t work.<br>
&gt;<br>
&gt; Best regards,<br>
&gt;<br>
&gt; Joson<br>
&gt;<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>