newbie question about PYTHONPATH

T

Tim Hanson

I am to the point in _Learning_Python_ where functions are introduced.

I decided to experiment by putting a function into a file and importing it
into Idle. Of course, Idle couldn't find it, so I executed the following
command in Bash:

PYTHONPATH=/home/foo/prog/learning_python
export PYTHONPATH
env | grep PYTHONPATH

~$PYTHONPATH=/home/foo/prog/learning_python

Idle still won't find it. I'm doing something wrong?
 
D

Doug Epling

The best way I have found is to place that definition of your PYTHONPATH
in your .bash_profile in your home directory and export it from there.

PYTHONPATH=/home/foo/prog/learning_python

export PYTHONPATH

This way your PYTHONPATH is picked up each time you log on. You
might have to restart IDLE for the changes you mention below to take effect.
 
A

Andrea Crotti

Il giorno 19/feb/2011, alle ore 18.25, Doug Epling ha scritto:
The best way I have found is to place that definition of your PYTHONPATH in your .bash_profile in your home directory and export it from there.

PYTHONPATH=/home/foo/prog/learning_python

export PYTHONPATH

This way your PYTHONPATH is picked up each time you log on. You might have to restart IDLE for the changes you mention below to take effect.

Yes but like this you overwrite it
export PYTHONPATH=/your/path:$PYTHONPATH

is much more safe to use
 
W

Westley Martínez

Il giorno 19/feb/2011, alle ore 18.25, Doug Epling ha scritto:


Yes but like this you overwrite it
export PYTHONPATH=/your/path:$PYTHONPATH

is much more safe to use
It's even safer to use
export PYTHONPATH=$PYTHONPATH:/your/path
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top