If you run:

sudo sudo -V

It should tell you your sudo settings.  Including a list of all
environment variables not passed to sudo.  This will usually include
PYTHONPATH.  You should be able to work around it with:

sudo env PYTHONPATH=$PYTHONPATH command_to_run

At least, that worked for me in ubuntu.  Don't know about macosx :)

-John Shaver

On Mon, Jun 7, 2010 at 9:05 AM, Garrett Hyde <[email protected]> wrote:
> What do you get when you execute
>
> sudo echo $PYTHONPATH?
>
> -- Garrett Hyde
>
>
> On Mon 07 Jun 2010, at 08:59 AM, Matthew Gardner wrote:
>
>> I'm trying to install a python package on my mac (nltk) that requires 
>> another package that I installed (yaml).  I've had some messy problems with 
>> using macports to install python packages, but I think I just found out what 
>> the problem is.  I installed yaml using macports, so it is found in 
>> /opt/local/lib/....  I've set my PYTHONPATH to use it, so I can start python 
>> in a terminal and import yaml just fine.  But when I try to install nltk 
>> from source, I run sudo setup.py install, it gives me an import error ("No 
>> module named yaml").  I discovered that when I just type sudo python and get 
>> an interactive interpreter, I can't import yaml, because /opt/local/lib/... 
>> isn't on my PYTHONPATH.  I searched for a while trying to figure out how to 
>> set my system PYTHONPATH on osx, but I can't find anything helpful.  Any 
>> help?
>>
>> Matt
>> --------------------
>> BYU Unix Users Group
>> http://uug.byu.edu/
>>
>> The opinions expressed in this message are the responsibility of their
>> author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG.
>> ___________________________________________________________________
>> List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list
>
> --------------------
> BYU Unix Users Group
> http://uug.byu.edu/
>
> The opinions expressed in this message are the responsibility of their
> author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG.
> ___________________________________________________________________
> List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list
>
--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list

Reply via email to